Open catmando opened 6 years ago
similar problem exists elsewhere in permissions:
class ActiveRecord::Base
def self.belongs_to(attr_name, *args)
belongs_to_without_reactive_record_add_is_method(attr_name, *args).tap do
define_method "#{attr_name}_is?".to_sym do |model|
self.class.reflections[attr_name].foreign_key == model.id
end
end
end
end
end
some aliases of belongs_to have a signature like this:
attr_name, scope = nil, opts = {}
, but in reality, it must beattr_name, *args
.