Any thoughts on why this in environment.rb will cause test:units to fail? # Requires for application config (/config/config.yml) require ''ostruct'' require ''yaml'' config = OpenStruct.new(YAML.load_file("#{RAILS_ROOT}/config/ config.yml")) env_config = config.send(RAILS_ENV) config.common.update(env_config) unless env_config.nil? ::AppConfig = OpenStruct.new(config.common) It fails on: env_config = config.send(RAILS_ENV) With: /home/thomas/src/entropic/config/environment.rb:18:in `test'': wrong number of arguments (ArgumentError) --for the record, I snagged that bit of code off the web because I needed a nice way of getting "global" app config stuff in the app; having no experience with the "right" way of doing that in rails. For instance, with "AppConfig.app_version" referencing the corresponding config.yml section... --the alternative, I know, is to snazz it up and make a config model, storing stuff in the db. so don''t hesitate to leave 1995 alone and drop config.yml and do it in the db. ;) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
join now http://rw2an.net/vb --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
That''s because ENV_RAILS is still nil at the time of execution of this piece of code. in environment.rb you can force it with: ENV[''RAILS_ENV''] ||= ''production'' -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Oh joy, right. Thanks! On Oct 26, 5:09 am, Fernando Perez <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> That''s because ENV_RAILS is still nil at the time of execution of this > piece of code. in environment.rb you can force it with: ENV[''RAILS_ENV''] > ||= ''production'' > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---