This project is archived and is in readonly mode.
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
-
José Valim January 18th, 2010 @ 07:59 PM
- Milestone cleared.
- Assigned user set to Pratik
-
Pratik January 18th, 2010 @ 08:29 PM
Hey Sam,
Could you please add a failing test in AR test suite ? Also, can you still reproduce this ?
Thanks.
-
Sam Saffron January 20th, 2010 @ 09:51 PM
Pratik,
Still getting this in trunk, I tried setting up an equivalent test with treasures and was not able to repro. Will continue trying to dig down.
-
José Valim June 15th, 2010 @ 10:19 PM
- State changed from new to resolved
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>