This project is archived and is in readonly mode.

#3739 ✓resolved
Sam Saffron

Active record is getting confused with some complex has_many conditions

Reported by Sam Saffron | January 18th, 2010 @ 01:18 PM | in 3.0.2

I have this has_many clause

has_many :top_comments, :order => 'created_at asc', :conditions => {deleted => false}, :limit => Comment.comments_to_display , :as => :commentable, :class_name => 'Comment'

it works fine in 2.3.5

in 3.0 I needed to change it to

has_many :top_comments, :order => 'created_at asc', :conditions => "deleted = 0", :limit => Comment.comments_to_display , :as => :commentable, :class_name => 'Comment'

something was making arel double escape comments (eg. ''comments''.'deleted' = 0)

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>

Pages