Explain to me how config works in Rails

Viewed 3874

I have a Rails 3 application, call it "MyApp". In my config\environments\production.rb file I see such things as

MyApp::Application.configure do
  config.log_level = :info
  config.logger = Logger.new(config.paths.log.first, 'daily')
   ...or...
  config.logger = Logger.new(Rails.root.join("log",Rails.env + ".log"),3,20*1024*1024)

So, questions are focusing on terminology and wtf they mean... (or point me to some site ,I have looked but not found, to explain how this works.)

  1. MyApp is a module?
  2. MyApp::Application is a ...? What, a module too?
  3. MyApp::Application.configure is a method?
  4. config is a variable? How do I see it in console?
  5. config.logger is a ???
  6. config.paths.log.first is a ...?? --in console I can see "MyApp::Application.configure.config.paths.log.first" but don't know what that means or how to extract info from it!?!

Is this too much for one question? :)

I have looked at the tutorial http://guides.rubyonrails.org/configuring.html but it jumps right into what things do.

2 Answers
Related