I want to accomplish the same thing Rails has done, to store configurations in rb files that are read by the application:
# routes.rb
MyApp::Application.routes.draw do |map|
root :to => 'firstpage#index'
resources :posts
In rails the methods "root" and "resources" are not defined in the object "main" scope.
That means that these methods are defined in either a module or a class. But how did they require the routes.rb file and used these methods from a class/module.
Because if I use "require" then these methods will be executed in the "main" scope, no matter where i run "require".
So how could you like Rails read this configuration file and run the methods defined in a class/module?
Thanks