Re: [Rails-core] Should the secret_token.rb be added to the .gitignore?

2013-01-11 Thread kristian
just looked in the application which I just workinig on and indeed I missed this securty_token.rb thingy though I know about it. PLEASE just make the overall setup more secure. for example development + test could use a SecureRandom.hex(64) as security token and production needs to do something ma

Re: [Rails-core] Possible bug in Rails 2.3.14, controller tests always seem to rescue action with handler

2012-03-08 Thread kristian
so no security fixes for 3.0.x ? that comes at a big surprise and feels like being in the rains. regards, Kristian On Fri, Mar 9, 2012 at 4:09 AM, Michael Koziarski wrote: > > > On Friday, 9 March 2012 at 11:38 AM, Steve Schwartz wrote: > > Just to clarify for everyone, N and N

Re: [Rails-core] ActiveResource 3.2.1 : ActiveResource::Formats::JsonFormat.decode and ActiveResource::Base.include_root_in_json

2012-03-03 Thread kristian
uby > code and makes me feel that you don't know Ruby enough. Please, post the > full code as it is actually easier to read the code with all its "syntactic > sugar". > please have a look at http://api.rubyonrails.org/classes/ActiveResource/Base.html and see where this is coming

Re: [Rails-core] Rails interactive

2011-09-01 Thread kristian
source.org/roo regards, Kristian On Fri, Sep 2, 2011 at 5:25 AM, Rodrigo Rosenfeld Rosas wrote: > I find your propose too verbose to my taste :P > > But I'm sure others will like your idea. :) > > I think that an alternative interface to the command-line old fashioned (and

Re: [Rails-core] 3.1.0rc4 - Uninitialized constant Rack::Session::Abstract::SessionHash

2011-06-17 Thread kristian
does RVM handles the different JVMs (from ibm, sun, openjdk, jrocket) and its different versions ? - Kristian PS just a thought: never is never right. always is always wrong On Fri, Jun 17, 2011 at 3:54 PM, Rodrigo Rosenfeld Rosas wrote: > Honestly, I always see Ubuntu Server as a joke. I im

[Rails-core] Re: ActiveRecord 3.1 - Mass-Assignment Roles

2011-05-18 Thread Kristian Mandrup
ay 18, 6:11 pm, Michael Koziarski wrote: > On Wed, May 18, 2011 at 11:52 AM, Kristian Mandrup wrote: > > I'm curious whether you can define the :as option as a list of roles? > > All the examples I have seen only has the :as linked to the single > > role :admin. > > In

[Rails-core] Re: ActiveRecord 3.1 - Mass-Assignment Roles

2011-05-18 Thread Kristian Mandrup
I'm curious whether you can define the :as option as a list of roles? All the examples I have seen only has the :as linked to the single role :admin. How would I use this with a roles system? Say I had a #current_user_roles method available from my Controller or whatever. def update Project.upd

[Rails-core] Re: What is the deal with Controller additions and helper methods!?

2010-05-13 Thread Kristian Mandrup
All I actually wanted to do was to add some helper methods for my views. I kind of "solved" the problem by rethinking my approach, as I could see I had gone down a "blind alley". module ApplicationHelper def self.auth_assist_helpers include AuthAssistant::ViewHelpers end end module AuthAs

[Rails-core] link_to using smart API

2010-05-13 Thread Kristian Mandrup
Trying to use the "smart" API for link_to def create_link(object, label = nil) label ||= auth_labels[:new] link = link_to(label, [:new, object]) if can?(:create, object) link.sub /new\./, 'new/' end But this generates a link like /projects/new.1 , instead of /projects/ new I would assu

[Rails-core] What is the deal with Controller additions and helper methods!?

2010-05-13 Thread Kristian Mandrup
I have ben struggling the past two days getting a this tiny piece of functionality to work without any success :( Trying to add a simple helper method to my views in order to ensure links are only displayed if the user has the proper rights to access that functionality. def show_link(object

[Rails-core] Re: Request: Make UrlHelper methods available for controllers

2010-05-13 Thread Kristian Mandrup
I'm having problems using url_for in a controller. The original method looks like this, but the @controller variable is unknown in this context. However if I remove it, it goes in an endless loop for the Hash case. Anyone? def url_for(options = {}) options ||= {} url = case o

[Rails-core] Request: Make UrlHelper methods available for controllers

2010-05-13 Thread Kristian Mandrup
I had a need for accessing the methods in ActionView::Helpers::UrlHelper in my controllers to conditionally return link HTML to my views depending on login state etc. I think that the UrlHelper should by default be added to all Controllers and methods such as link_to made available for views using

[Rails-core] Re: Trouble developing Rails plugins/gems with generators

2010-05-13 Thread Kristian Mandrup
It turned out I had to include the require statement in an initializer. Putting it in the application.rb didn't work (not found error). I has to due with the load order I'm sure. Thanks for the help :) > > I think you still need to require it in the application.rb file. I might be > wrong as I ha

[Rails-core] Re: Loading files in Rails lib folder?

2010-05-12 Thread Kristian Mandrup
Yes, it worked by inserting the require statements in the initializers. On May 12, 12:00 pm, Kristian Mandrup wrote: > How does the lib folder work in Rails 3? > > In Rails 2.x you would add require statements in application.rb, fx: > > /lib >   blip.rb > >

[Rails-core] Re: Loading files in Rails lib folder?

2010-05-12 Thread Kristian Mandrup
OK, it seems it works using autoload, being lazy loaded when accessed. But what if I want to force it to be loaded when rails starts? Appending a require 'blip' in application.rb I am told no such file exists!? Would I have to insert it in an initializer? # lib/blip.rb puts "Blip loaded!" class

[Rails-core] Loading files in Rails lib folder?

2010-05-12 Thread Kristian Mandrup
How does the lib folder work in Rails 3? In Rails 2.x you would add require statements in application.rb, fx: /lib blip.rb # blip.rb puts "BLIP" # application.rb ... require 'blip' --- But using the same approach doesn't work in Rails 3. How do I configure this so that blip.rb is loaded when

[Rails-core] Re: Trouble developing Rails plugins/gems with generators

2010-05-12 Thread Kristian Mandrup
On a further note. I can't seem to get any .rb files in RAILS_ROOT/lib to load when I start my rails server. Say I have a file # lib/auth_assistant.rb puts "Hello from AuthAssist" -- In the old days of Rails 2.3+ you would put a require statement in application.rb, but I think in Rails 3 all fil

[Rails-core] Re: Trouble developing Rails plugins/gems with generators

2010-05-12 Thread Kristian Mandrup
ere... any idea how to do this? I could hack it using "run" which works, but produces: run rails g migration add_admin_field_to_user admin:boolean from "." Which just doesn't feel right ;) Thanks! On May 12, 10:27 am, Anuj Dutta wrote: > On 12 May 2010 19:55, Kri

[Rails-core] Re: Trouble developing Rails plugins/gems with generators

2010-05-12 Thread Kristian Mandrup
I worked it out myself. It had to do with the fact that the generators for some reason require the namespace to match a containing folder, much like the Java package mechanism. lib/generators - auth_asisst - ability ability_generator.rb # ability_generator.rb module AuthAssist module G

[Rails-core] Trouble developing Rails plugins/gems with generators

2010-05-12 Thread Kristian Mandrup
Hi, I've been trying to develop a Rails gem/plugin with generators for Rails 3. I first had a separate gem project with a gem statement in my Gemfile with a :path option to point at it. But then I had to run $ rake install on each change in my gem to have Rails pick up on it. I have now instead pu

[Rails-core] Re: Rails 3 edge broken for Ruby 1.9.2-preview1

2010-05-11 Thread Kristian Mandrup
Thanks! That works :) On May 11, 4:25 am, Yehuda Katz wrote: > Can you try 1.9.2-head? > > Yehuda Katz > Architect | Engine Yard > (ph) 718.877.1325 > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to

[Rails-core] Rails 3 edge broken for Ruby 1.9.2-preview1

2010-05-10 Thread Kristian Mandrup
First tried creating default Rails app using Rails 3-beta3 $ rails simple $ mate Gemfile gem 'rails', '3.0.0.beta3' $ cd simple simple kristianconsult$ rails s /Users/kristianconsult/.rvm/gems/ruby-1.9.2-preview1/gems/ activesupport-3.0.0.beta3/lib/active_support/values/time_zone.rb: 208:in `u

[Rails-core] Re: Using Rails 3 edge to circumvent current_period bug?

2010-05-10 Thread Kristian Mandrup
Thanks. I've just been away from Rails dev for a bit too long... # Bundle edge Rails instead: gem 'rails', :git => 'git://github.com/rails/rails.git' On May 10, 7:09 pm, Michael Koziarski wrote: > On Tue, May 11, 2010 at 11:01 AM, Kristian Mandrup wrote: >

[Rails-core] Re: Using Rails 3 edge to circumvent current_period bug?

2010-05-10 Thread Kristian Mandrup
Hmm, I guess I could just clone github rails and then use the :path option in my Gemfile to point to that version, but is there another way? On May 10, 3:58 pm, Kristian Mandrup wrote: > I get an error using Rails 3 beta3 on Ruby 1.9.2-preview1 > > undefined method `current_pe

[Rails-core] Using Rails 3 edge to circumvent current_period bug?

2010-05-10 Thread Kristian Mandrup
I get an error using Rails 3 beta3 on Ruby 1.9.2-preview1 undefined method `current_period' for nil:NilClass (NoMethodError) This commit should fix it http://github.com/rails/rails/commit/a0cc94b32e5b4e4dce50787eed1208406f99ea82 But I forgot how to ensure I am running on edge with Rails 3. Is i

[Rails-core] How are path segments in Rails 3? needed for upgrade of translate_routes plugin

2010-04-28 Thread Kristian Mandrup
I have been trying to upgrade the translate_routes plugin from Rails 2 to 3. Looking into the Rails 3 source, I can't seem to gem a grip on how the Path Segments are handled now. Maybe it has to do with the new Rack way of doing things? Fx a url could have a date at the end in the form of :yy/:mm/

[Rails-core] Re: Bundler caching issues when updating gem locally

2010-04-24 Thread Kristian Mandrup
Thank you so much! Just what I was looking for. I knew there had to be a way... It doesn't seem like the :path option is mentioned much however. On Apr 19, 6:42 pm, Mislav Marohnić wrote: > First of all, this is not a list to discuss Bundler features or development. > Ask on #carlhuda Freenode ch

[Rails-core] Bundler caching issues when updating gem locally

2010-04-19 Thread Kristian Mandrup
If I have a gem locally that I change without updating the version number the bundler never seems to notice. I have a gem fx 'devise-assistant' version 0.1.0. If I add a single method and run 'rake install' and then 'bundle install' in my Rails app, then bundler seems to think the gem has not been

[Rails-core] Re: Rails 3 beta3 app generator does not generate default stylesheet

2010-04-14 Thread Kristian Mandrup
$ rails g stylesheet Could not find generator stylesheet. I guess not... but http://github.com/rails/rails/tree/master/railties/lib/rails/generators/rails/stylesheets contains a stylesheets generator $ rails g Please choose a generator below. Rails: controller generator helper integrat

[Rails-core] Re: Installing mongrel for Rails 3 app?

2010-04-14 Thread Kristian Mandrup
$ gem install mongrel --source http://gems.rubyinstaller.org mongrel 1.1.6 installed # Gemfile gem "mongrel" gem "cgi_multipart_eof_fix" gem "fastthread" $ rails s => Booting Mongrel => Rails 3.0.0.beta3 application starting in development on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-

[Rails-core] Installing mongrel for Rails 3 app?

2010-04-14 Thread Kristian Mandrup
I first tried a simple gem 'mongrel' Then later the solution found here http://jan.varwig.org/archive/rails-3-and-mongrel gem "mongrel" gem "cgi_multipart_eof_fix" gem "fastthread" gem "mongrel_experimental" But still can't get it to work... Anyone? -- You received this message because you

[Rails-core] Re: Rails 3 beta3 app generator does not generate default stylesheet

2010-04-14 Thread Kristian Mandrup
OK, the tutorial must have been for beta2. Now error_messages is a plugin! rails plugin install git://github.com/rails/dynamic_form.git -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-c...

[Rails-core] Re: Rails 3 beta3 app generator does not generate default stylesheet

2010-04-14 Thread Kristian Mandrup
Also using <%= form.error_messages %> to display error messages, only results in this output: Where is the bullet list of errors? Strange! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrai

[Rails-core] Re: Rails 3 beta3 app generator does not generate default stylesheet

2010-04-14 Thread Kristian Mandrup
It turns out that Yehuda seems to have 'cheated' a little with the screencast. The app needs the scaffold.css. http://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css Is there a way to generate this stylesheet without scaffolding? -- You

[Rails-core] Rails 3 beta3 app generator does not generate default stylesheet

2010-04-14 Thread Kristian Mandrup
I have just been following the updated 15 min blog tutorial by Yehuda http://www.railsdispatch.com/posts/rails-3-makes-life-better I noticed by browser outputs looked a bit weird. Then I discovered I had no stylesheet generated. Is this a known bug or what? Does someone have a link to the default

[Rails-core] Decoupling the view layer in Rails 3 - install UJS and template/css frameworks as gems using generator

2010-03-17 Thread Kristian Mandrup
Since the idea of UJS is loose coupling, the UJS framework of choice should be installed as a gem, just like we do for markup languages such as Redcloth etc. Same goes for the template language IMO. Rails doesn't even require any view frontend in many cases, fx when using a javascript framework su

[Rails-core] Rails 3 routing path segments

2010-03-05 Thread Kristian Mandrup
I have been trying to port the translate_routes plugin for use with Rails 3. The current version uses the old StaticSegments, but it looks like this has now been simplified to simple strings. How would I get the static parts of a registered route in Rails 3? Would I have to parse the string mysel

[Rails-core] New gem 'thor-ext' with addons and patches for updating the Gemfile

2010-02-07 Thread Kristian Mandrup
I know the code could be much improved, fx the add_gem has so far no support for an options hash. Perhaps this could be integrated into the original Rails::Generators::Actions in a new fork? I will also work on a 'txt-mutator' gem with a DSL for general-purpose code (text file) refactorings. 'thor

[Rails-core] Rails 3 - bundle install : ffi 0.5.4 gem error - building with native extensions

2010-02-07 Thread Kristian Mandrup
kristian-mandrups-macbook-pro:demo_app kristianconsult$ bundle install Updating git://github.com/rails/rails.git Updating git://github.com/rails/arel.git Updating git://github.com/rails/rack.git Updating git://github.com/rspec/rspec.git Updating git://github.com/negonicrac/rspec-rails.git Updating

[Rails-core] Re: Rails 3 generators for scaffolding models according to selected ORM - how?

2010-01-30 Thread Kristian Mandrup
Thanks to everyone!!! I have been working a lot on this since this post and I have figured it all out "with a little help from some friend". I'm on Ruby 1.9.1, Rails 3.0 pre. Been creating a lot of nice new Rails 3 generators, currently working on Rails 3 templates!!! I have created a gem "txt_fi

[Rails-core] Re: Request: newline missing in emfile when using gem statement in Rails 3 templates

2010-01-30 Thread Kristian Mandrup
I propose the following fix: module Thor class Actions def append_line_file(file, txt, *args) append_file file, "#{txt}\n", args end end end module Rails module Generators module Actions def gem(*args) options = args.extract_options! name, version = a

[Rails-core] Re: Request: newline missing in emfile when using gem statement in Rails 3 templates

2010-01-30 Thread Kristian Mandrup
Found it in rails/railties/lib/rails/generators/actions.rb def gem(..) ... in_root do append_file "Gemfile", "gem #{parts.join(", ")}", :verbose => false end Should add a newline! append_file "Gemfile", "gem #{parts.join(", ")}\n", :verbose => false Or perhaps extend with a

[Rails-core] Request: newline missing in emfile when using gem statement in Rails 3 templates

2010-01-30 Thread Kristian Mandrup
When I use the Rails templates features and use the gem statemtent, the gems in the Gemfile end up being appended without a newline like the following: mytemplate.rb -- gem "rspec" gem "cucumber" gem "cucumber-rails" --> Gemfile gem "rspec"gem "cucumber"gem "cucumber-rails" -- Not very pretty!

[Rails-core] Re: Discovered potential rails 3 error: lib/rails/generators.rb:269 - undefined method `application' for Rails:Module

2010-01-29 Thread Kristian Mandrup
The solution was to add require 'rails' to my executable. But I still see it as an odd edge case and a bit of a "hack"... nifty_controller -- #!/user/local/bin/ruby ... require 'rails' require 'rails/generators' require 'generators/nifty/controller/controller_generator' Nifty::Generators::C

[Rails-core] Discovered potential rails 3 error: lib/rails/generators.rb:269 - undefined method `application' for Rails:Module

2010-01-28 Thread Kristian Mandrup
/kristianmandrup/very_nifty_generators --- kristian-mandrups-macbook-pro:r3_test kristianconsult$ script/generate nifty:controller cat create app/controllers/cats_controller.rb invoke erb createapp/views/cat invoke test_unit createtest/functional/cat_controller_test.rb

[Rails-core] Re: Creating a rails 3 app generator executable using thor

2010-01-28 Thread Kristian Mandrup
I fixed it with a pretty ugly hack :P def initialize(*args, &block) super @my_options ||= {} ... if arg == '!' @my_options[:invert] = true ... if @model_attributes.empty? @my_options[:skip_model] = true def do_skip_model?

[Rails-core] Re: Creating a rails 3 app generator executable using thor

2010-01-28 Thread Kristian Mandrup
/generators/nifty/scaffold/scaffold_generator.rb:53:in `initialize' -- Is there a nice way to fix this? Do I have to create a non-frozen custom options collection or someone has a better idea? Kristian -- You received this message because you are subscribed to the Google Groups &

[Rails-core] Creating a rails 3 app generator executable using thor

2010-01-28 Thread Kristian Mandrup
;rails"] .. -- So I assume, to make a gem executable, you simply need to define the executables, put an executable in the bin folder, fx bin/my_executable and have that executable require and then call start on the application generator? Thanks! Kristian -- You received this message becaus

[Rails-core] Re: Overriding the default rails app generator - how?

2010-01-28 Thread Kristian Mandrup
Sounds great! How would I do that exactly? http://yehudakatz.com/2008/05/12/by-thors-hammer/ -- Thor, as it exists today, has two components: * The Thor superclass, which works exactly like CLI/Hermes, except that you inherit from it instead of including it (class MyApp < Thor). * The Tho

[Rails-core] Overriding the default rails app generator - how?

2010-01-28 Thread Kristian Mandrup
Hi, I have been working a lot on getting a grasp of creating rails 3 generators. I have created some nifty generators and some Mongo Mapper and Mongo generators. Now I am considering creating a complete Rails app generator, to customize it to my needs. It seems a bit akward to use the "current" a

[Rails-core] Re: Rails 3 generators for scaffolding models according to selected ORM - how?

2010-01-28 Thread Kristian Mandrup
I never managed to get the datamapper_on_rails3 app to work. I tried to follow the instructions in the readme. I always get this error when I try a scaffold inside the app: kristian-mandrups-macbook-pro:datamapper_on_rails3 kristianconsult$ script/generate scaffold Profile nick:string /Users

[Rails-core] Re: Rails 3 generators for scaffolding models according to selected ORM - how?

2010-01-27 Thread Kristian Mandrup
Here is my repo ;) Thanks! http://github.com/kristianmandrup/datamapper_rails3_demo > Hello Kristian, > > Sorry, I did not know you were doing that already. Right, so can you point > me to your repository please and I will run it on my system and debug it. > > Thanks > >

[Rails-core] Re: Rails 3 generators for scaffolding models according to selected ORM - how?

2010-01-27 Thread Kristian Mandrup
, Martin Gamsjaeger wrote: > Anuj and Kristian, > > First of all, I'd like to point out that the canonical repo for > rails3_datamapper is http://github.com/dkubb/rails3_datamapper.. mine > is just a fork, altho i'm the primary committer to dkubb's repo. Just > wanted

[Rails-core] Re: Critical Rails 3 scaffold error - undefined method `to_sym' for nil:NilClass

2010-01-27 Thread Kristian Mandrup
ruby/1.9.1/dirs/rails/activesupport/lib/active_support/ dependencies.rb:115:in `rescue in const_missing' .. Am I missing some inportant initialization step? $ bin/rake db:create (in /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3) Creating database 'rails3_development&#

[Rails-core] Re: Rails 3 generators for scaffolding models according to selected ORM - how?

2010-01-27 Thread Kristian Mandrup
scaffold on the rails3_datamapper application I get an error: kristian-mandrups-macbook-pro:datamapper_on_rails3 kristianconsult$ script/generate scaffold Post /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/dirs/rails/activesupport/lib/active_support

[Rails-core] Re: Rails 3 generators for scaffolding models according to selected ORM - how?

2010-01-27 Thread Kristian Mandrup
So it works as long as I only specify controller/model and attributes Here I set g.orm :mongo_model But where do I map this orm symbol to the correct model generator I wonder? $ script/generate scaffold Person name:string error mongo_model [not found] route resources

[Rails-core] Rails 3 generators for scaffolding models according to selected ORM - how?

2010-01-27 Thread Kristian Mandrup
I have installed Mongo DB and created my first Rails 3 model generator as a gem, which can create Mongo Mapper models in a Rails 3 project :) See http://github.com/kristianmandrup/mongo_model_r3 Also available from gemcutter as mongo_model 0.2.1. I am now trying to create a scaffold generator us

[Rails-core] Critical Rails 3 scaffold error - undefined method `to_sym' for nil:NilClass

2010-01-27 Thread Kristian Mandrup
$ script/generate scaffold Post name:string index /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ruby/ 1.9.1/gems/activesupport-3.0.pre/lib/active_support/whiny_nil.rb:49:in `method_missing': undefined method `to_sym' for nil:NilClass (NoMethodError) from /Users/kristiancon

[Rails-core] Re: Closing in on Last Call for the Beta

2010-01-21 Thread Kristian Mandrup
Really great work!!! Now we just need the community to write some good blog posts on how to use all the new APIs ;) I'm playing with Rails 3pre now, but running into some roadblocks on the way... -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" g