Arnold Roa Arnold Roa - 1 year ago 78
Ruby Question

condition on model on class macros

It's possible to put conditions on models like:

class MyPeppers < ActiveRecord::Base
acts_as_a_ferret() if Rails.env.production?

It's valid ruby code but I wonder if that should work?

Answer Source

Yes, it will work because it is a perfectly valid Ruby code.