I’m trying to discover which rails command am I running on a initializer module like this:
module MyModule
class Railtie < Rails::Railtie
initializer "my_module.configure_rails_initialization" do |app|
puts "RAILS #{s} RUNNING!"
#do something with ze app
end
end
end
The possible commands are: generate, console, server, dbconsole, runner
I’ve read initialization guide at: http://guides.rubyonrails.org/initialization.html
But didn’t found how to get which command at initialization time.
Any suggestion?
This is not a full answer of your question but a workaround I’ve used.
I needed to know if “rails console” was started.
I simply tested if the console class was defined:
You can also use this option for Rails::Server
For dbconsole, runner and generate the solution above doesn’t work