Does Rails initializers gets called when I run rails console

Yes, every .rb file in config/initializers is run whenever you run the console, run a rake task, or run your tests. Additonally, the environment configuration (config/environments) is run before the initializers.


Apparently not anymore unless you disable spring:

export DISABLE_SPRING=1


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.