rails config/environments where is 'config' defined?

Viewed 53

In config/environments/production.rb (and the other environments) there is:

config.eager_load = true

and a whole bunch of other config.foobar calls. But where does 'config' come from? Usually you have something like:

SomeClass.each do | block_variable |
  block_variable.some_method
end

but in the case of the mystical 'config' this is not the case, its like a block variable which is not declared anywhere. Opening rails console, when I do:

irb(main):001:0> config
NameError: undefined local variable or method `config' for main:Object
Did you mean?  conf
        from (irb):1
irb(main):002:0>

and the same result occurs for app.config

irb(main):002:0> app.config
NoMethodError: undefined method `config' for #<ActionDispatch::Integration::Session:0x00007fc898d02808>
        from (irb):2

How is it possible for ruby to allow calls on 'config'?

1 Answers
Related