Skip to content
This repository has been archived by the owner on Oct 19, 2018. It is now read-only.

inconsistent parameter passing in belongs_to method #93

Open
catmando opened this issue Apr 30, 2018 · 1 comment
Open

inconsistent parameter passing in belongs_to method #93

catmando opened this issue Apr 30, 2018 · 1 comment

Comments

@catmando
Copy link
Contributor

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 added a commit that referenced this issue May 4, 2018
@catmando
Copy link
Contributor Author

catmando commented Jun 6, 2018

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant