问题
My Rails 3.1 application is completely implemented inside a namespace. When I open the Rails console I would like to be able to directly access identifiers inside my namespace. I would like not to have to type the full qualified names everytime.
Instead of
Aef::Newman::HandledAddress
I would like to write
HandledAddress
Including the namespace inside the console like the following does not help for some reason:
include Aef::Newman
回答1:
You can create an irb sub-session, "moving into" the desired namespace by typing
irb Aef::Newman
See here and the IRB documentation, here
来源:https://stackoverflow.com/questions/8615856/include-namespace-in-rails-3-1-console