I want to put my chargify conf inside the initializer, but I found the initializer won't execute in my rails c, is there a way to invoke my initializers so I can test in my console?
Chargify.configure do |c|
c.api_key = "keykey"
c.subdomain = "test-site"
end
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.
Go 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 .
The config/initializers
will execute, but only once, on initial load. So if you're making changes to config/initializers
while the console is running you won't see the results of those changes happening.
Your best option is to stop and restart rails c
, or you can type the reload!
command in the console.
Also, if you are using spring that will sometimes prevent changed initializers from reloading. in that case do spring stop
before you restart the console.
Apparently not anymore unless you disable spring:
export DISABLE_SPRING=1
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