clio / polymorphic_integer_type

MIT License
37 stars 35 forks source link

has_many takes 3 args in Rails 4.1 #7

Closed rjharmon closed 9 years ago

rjharmon commented 10 years ago

In Rails 4.1, I needed this slightly different implementation of has_many, because of signature differences with 3.2

  def has_many(name, scope=nil, options = {}, &extension)
    remove_type_and_establish_mapping(name, options)
    super(name, scope, options, &extension)
  end
doliveirakn commented 10 years ago

Ahh noted. I'm currently using this in a 3.2 app and haven't seen if it would work with 4.1 yet. I'll see if I can get a version out that supports 4.1 within the next week or so.

doliveirakn commented 10 years ago

The has_many needs to add conditions in order for it to work. If you pass in a scope like has_many :foo, ->{ where(..)}, {}, I'm not sure how to merge my conditions onto the existing one.

I won't be able to create a new version that supports 4.1 yet due to this.

doliveirakn commented 10 years ago

I've created a branch rails-4 that contains the changes to make it work on rails 4 (with the exception of the situation mentioned above) https://github.com/doliveirakn/polymorphic_integer_type/pull/8

I will keep that branch in sync with the releases until I can figure out a way to make it work.