hyper-mesh icon indicating copy to clipboard operation
hyper-mesh copied to clipboard

inconsistent parameter passing in belongs_to method

Open catmando opened this issue 7 years ago • 1 comments

some aliases of belongs_to have a signature like this: attr_name, scope = nil, opts = {}, but in reality, it must be attr_name, *args.

catmando avatar Apr 30 '18 19:04 catmando

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

catmando avatar Jun 06 '18 19:06 catmando