rails/rails — Issue #3377: ActiveRecord : Name conflict with "association"
Author: Dorian
Created: 2011-10-20 11:46:23+00:00
State: open

I have a name conflict with the function "association", because I have a model "Association" and ActiveRecord now use (since 3.1 I think).

The code in ActiveRecord is : (in */usr/lib/ruby/gems/1.8/gems/activerecord-3.1.1/lib/active_record/associations/builder/association.rb*)

def define_writers
name = self.name

model.redefine_method("#{name}=") do |value|
association(name).writer(value)
end
end

And my error is, when I do Role.first.association :

SystemStackError: stack level too deep
from /usr/lib/ruby/gems/1.8/gems/activerecord-3.1.1/lib/active_record/associations/builder/association.rb:41:in `association'
from /usr/lib/ruby/gems/1.8/gems/activerecord-3.1.1/lib/active_record/associations/builder/association.rb:41:in `association'
from (irb):4