ruby on rails - What is the value of `self` in routes.rb file? -


need understanding following routes.rb file:

rails.application.routes.draw   'help' => 'static_pages#help' end 

from understanding of ruby line:

get 'help' => 'static_pages#help' 

is same as:

self.get('help' => 'static_pages#help') 

then in case value of self?

self in routes.rb instance of actiondispatch::routing::mapper.

you can check putting

raise self.inspect 

in routes.rb , running

rails server 

visit localhost , you'll see this:

#<actiondispatch::routing::mapper:0x000000062598a0 @set=#<actiondispatch::routing::routeset:0x00000003d59500>,@scope=#<actiondispatch::routing::mapper::scope:0x00000006259850 @hash={:path_names=>{:new=>"new", :edit=>"edit"}}, @parent={}, @scope_level=nil>, @concerns={}, @nesting=[]> 

Comments