This project is archived and is in readonly mode.

#2306 ✓resolved
quake wang

AssociationCollection's destroy method is not compatible with old version

Reported by quake wang | March 21st, 2009 @ 06:20 AM | in 2.x


class Article < ActiveRecord::Base
  has_many :reviews
end

in rails 2.2.2, we can use fixnum parameter to destroy one collection object:


article = Article.find(params[:article_id])
article.reviews.destroy(params[:id])

the second line code generates sql which looks like this: SELECT * FROM reviews WHERE (article.id = 1) AND (reviews.id = 10) ORDER BY id desc DELETE FROM reviews WHERE id = 10

in rails 2.3, it will raise an exception: ActiveRecord::AssociationTypeMismatch: Review(#-615260898) expected, got Fixnum(#-604984008)

I thought this commit breaks the compatibility http://github.com/rails/rails/co...

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>

Tags

Referenced by

Pages