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!
2.1 bin/rails serverGo to your browser and open http://localhost:3000, you will see a basic Rails app running. You can also use the alias "s" to start the server: bin/rails s . The server can be run on a different port using the -p option. The default development environment can be changed using -e .
An initializer is any file of ruby code stored under /config/initializers in your application. You can use initializers to hold configuration settings that should be made after all of the frameworks and plugins are loaded.
Rails::Railtie is the core of the Rails framework and provides several hooks to extend Rails and/or modify the initialization process. Every major component of Rails (Action Mailer, Action Controller, Active Record, etc.) implements a railtie. Each of them is responsible for their own initialization.
Try this:
load "#{Rails.root}/config/initializers/your_file.rb"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With