DRY way of calling a method in every rails model

Posted by Tim on Stack Overflow See other posts from Stack Overflow or by Tim
Published on 2010-05-11T05:35:02Z Indexed on 2010/05/11 11:04 UTC
Read the original article Hit count: 219

Along the same lines as this question, I want to call acts_as_reportable inside every model so I can do one-off manual reports in the console in my dev environment (with a dump of the production data).

What's the best way to do this? Putting acts_as_reportable if ENV['RAILS_ENV'] == "development" in every model is getting tedious and isn't very DRY at all. Everyone says monkey patching is the devil, but a mixin seems overkill.

Thanks!

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about best-practices