This project is archived and is in readonly mode.

#3580 ✓duplicate
Danny Tipple

Has Many Association With Conditions And Dependant Throws Error

Reported by Danny Tipple | December 16th, 2009 @ 01:08 PM | in 2.3.9

When using a has many association with both conditions and dependent params a "wrong number of arguments (2 for 1)" error is thrown in activerecord-2.3.5/lib/active_record/associations.rb line 1416

One such example of this is..

has_many :comments, :foreign_key => 'commentable_id', :conditions => "commentable_type = 'User'", :dependent => :destroy

Simliar happens with..

has_many :comments, :foreign_key => 'commentable_id', :conditions => {:commentable_type => 'User'}, :dependent => :destroy

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Pages