07 Apr 2022   rails


So you can run code only if you’re in a rails console:

# config/application.rb
module MyApplication
  class Application < Rails::Application
    console do
      `say -vkyoko こんにちは` if Rails.env.development?
    end
  end
  #...
end

Now I receive a greeting every time I run bin/rails console

🍄