Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

There was a problem

rails 2.3.3 and has_many

#29

I found a problem with has_many on rails 2.3.3 (bug not present in 2.3.2).
Given the following models :

  Dentist < ActiveRecord::Base
    has_many :patients
  end

  Patient < ActiveRecord::Base
  end

and then on the console:

Loading development environment (Rails 2.3.3)
>> d = Dentist.new
=> #<Dentist id: nil, name: nil>
>> d.save
=> true
>> d.patients
ArgumentError: wrong number of arguments (2 for 1)
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/associations/association_proxy.rb:173:in `sanitize_sql'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/associations/association_proxy.rb:173:in `send'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/associations/association_proxy.rb:173:in `sanitize_sql'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/associations/association_collection.rb:41:in `find'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/associations/association_collection.rb:399:in `find_target'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/associations/association_collection.rb:353:in `load_target'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/associations/association_proxy.rb:139:in `inspect'
    from /usr/lib/ruby/1.8/irb.rb:302:in `output_value'
    from /usr/lib/ruby/1.8/irb.rb:151:in `eval_input'
    from /usr/lib/ruby/1.8/irb.rb:263:in `signal_status'
    from /usr/lib/ruby/1.8/irb.rb:147:in `eval_input'
    from /usr/lib/ruby/1.8/irb.rb:146:in `eval_input'
    from /usr/lib/ruby/1.8/irb.rb:70:in `start'
    from /usr/lib/ruby/1.8/irb.rb:69:in `catch'
    from /usr/lib/ruby/1.8/irb.rb:69:in `start'
    from /usr/local/bin/irb:13

Reported by user296 (at gmail) · July 21st, 2009 @ 03:42 AM

State: resolved
Milestone: none
Assigned to: Zach Dennis Zach Dennis

Activity

  1. Zach Dennis
    Zach Dennis
    • State changed from new to hold
    • Tag set to rails2.3.3

    This is fixed in master. I will push a new gem release tonight.

    July 22nd, 2009 @ 11:55 AM

  2. Zach Dennis
    Zach Dennis
    • State changed from hold to resolved

    released tonight in 0.9.2 ar-extensions

    July 22nd, 2009 @ 09:57 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.