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.

This project is archived and is in readonly mode.

Active record is getting confused with some complex has_many conditions

#3739

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)

Reported by Sam Saffron · January 18th, 2010 @ 01:18 PM

State: resolved
Milestone: 3.0.2
Assigned to: Pratik Pratik
Importance: Low

Activity

  1. José Valim
    José Valim
    • Milestone cleared.
    • Assigned user set to Pratik

    January 18th, 2010 @ 07:59 PM

  2. Pratik
    Pratik

    Hey Sam,

    Could you please add a failing test in AR test suite ? Also, can you still reproduce this ?

    Thanks.

    January 18th, 2010 @ 08:29 PM

  3. Sam Saffron
    Sam Saffron

    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.

    January 20th, 2010 @ 09:51 PM

  4. Ryan Bigg
    Ryan Bigg

    Sam, are you able to still duplicate this?

    June 12th, 2010 @ 03:41 AM

  5. Kane
    Kane

    i cant reproduce this in rails3beta4

    June 15th, 2010 @ 08:27 PM

  6. José Valim
    José Valim
    • State changed from new to resolved

    June 15th, 2010 @ 10:19 PM

  7. Ryan Bigg
    Ryan Bigg
    • Tag cleared.

    Automatic cleanup of spam.

    October 9th, 2010 @ 10:03 PM

  8. Jeremy Kemper
  9. Ryan Bigg
    Ryan Bigg

    Automatic cleanup of spam.

    October 21st, 2010 @ 03:34 AM

  10. Ryan Bigg
    Ryan Bigg

    Automatic cleanup of spam.

    November 8th, 2010 @ 01:53 AM

  11. bingbing