how can I run an initializer from the rails console?

爷,独闯天下 提交于 2019-12-03 12:49:39

问题


I've got an initialization file config/initializers/linkedin.rb that sets up the Linkedin gem so that my app can connect to the LinkedIn service and run queries. I'm now testing out some new features and I want to use the console for this. My problem - asside from being a newb and not understanding the console very well yet - is that I can't access the variables that are initialized in config/initializers/linkedin.rb.

Any ideas on how to use the application initializers from within the console so that I don't have to run this by hand every time?

Thanks!


回答1:


Try this:

load "#{Rails.root}/config/initializers/your_file.rb"


来源:https://stackoverflow.com/questions/9671152/how-can-i-run-an-initializer-from-the-rails-console

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