I'm using Rails 5.1. How do I get my initialization file (located at config/my_init.rb) to recognize when it is being run in the context of server startup versus when it is run in the context of a rake task? I thought the below would do it ...
puts "iniitializing ... #{(!Rails.env.test?) } defined; #{!defined?(::Rake)}"
if(!Rails.env.test?) && !defined?(::Rake)
And when I'm running a rake task, the " !defined?(::Rake)" correctly returns false ...
localhost:myproject davea$ rake db:seed
iniitializing ... true defined; false
but when I start up my server, that clause is still returning false
localhost:myproject davea$ rails s -b 127.0.0.1
=> Booting Puma
=> Rails 5.1.5 application starting in development
=> Run `rails server -h` for more startup options
iniitializing ... true defined; false
How can I make a distinction between teh two?