I can't see this in the docs, but I presume it's a solved problem.
I'm using ActiveRecord outside Rails, and my script loads a schema.rb dumped from another app. I want to load this schema without dumping the migration output to stdout, but replacing ActiveRecord::Base.logger doesn't shut it up. What should I be overriding to stop the noise?
The trick is apparently in ActiveRecord::Migration:
ActiveRecord::Migration.verbose = false
This makes migrations not output information to $stdout. There is a convenience wrapper method called .suppress_messages, which you can use like this:
ActiveRecord::Migration.suppress_messages do
load("path/to/schema.rb")
end
And yes, this is documented under Migration (but not under Schema, where I was looking).
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