Forum: Ruby on Rails config.send()...

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Thomas S. (Guest)
on 2008-10-26 02:07
(Received via mailing list)
Any thoughts on why this in environment.rb will cause test:units to

# Requires for application config (/config/config.yml)
require 'ostruct'
require 'yaml'
config ="#{RAILS_ROOT}/config/
env_config = config.send(RAILS_ENV)
config.common.update(env_config) unless env_config.nil?
::AppConfig =

It fails on:

env_config = config.send(RAILS_ENV)


/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. ;)
روقاااااااااان (Guest)
on 2008-10-26 10:56
(Received via mailing list)
Fernando P. (Guest)
on 2008-10-26 11:09
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'
Thomas S. (Guest)
on 2008-10-27 15:12
(Received via mailing list)
Oh joy, right.  Thanks!

On Oct 26, 5:09 am, Fernando P. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.