Include namespace in Rails 3.1 console

不打扰是莪最后的温柔 提交于 2019-12-13 01:07:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!