如何从rails控制台运行初始化程序?

问题描述:

我有一个初始化文件 config / initializers / linkedin.rb 设置Linkedin gem,以便我的应用程序可以连接到LinkedIn服务并运行查询。我现在正在测试一些新的功能,我想使用控制台这一点。我的问题 - 帮助成为一个新手,而不是很好地理解控制台 - 是我不能访问的变量在 config / initializers / linkedin.rb

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?

谢谢!

尝试:

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