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.

Patch: Access to more Arel predicate types from where condition hash

#4368

Similar to 'table.column' => 'value', this patch enables 'column#method' => 'value'.

For instance, Article.where('title#matches' => 'Hello%') generates SQL like:

SELECT "articles".* FROM "articles" WHERE ("articles"."title" LIKE 'Hello%')

This patch also handles the "any" and "all" predicates (simplified or/and syntax) which don't exist in the current Arel, but do in my Arel fork at http://github.com/ernie/arel. If anyone's looking here, I'd really appreciate some eyes on that fork as well for some possible additions to rails/arel. :)

Reported by Ernie Miller · April 12th, 2010 @ 03:18 AM

State: wontfix
Milestone: none
Assigned to: Pratik Pratik
Importance: none

Activity

  1. Ernie Miller
    Ernie Miller
    • No changes were found…

    April 12th, 2010 @ 01:23 PM

  2. Ernie Miller
    Ernie Miller

    Actually, attaching my Arel patch as well, for reference.

    April 12th, 2010 @ 01:35 PM

  3. Ernie Miller
    Ernie Miller

    Minor improvement to the check to valid comparison methods (check that method matches a method in Arel::Attribute::Predications instead of just checking if the attribute responds to the method)

    April 12th, 2010 @ 01:56 PM

  4. Ernie Miller
    Ernie Miller

    Minor improvement to the check to valid comparison methods (check that method matches a method in Arel::Attribute::Predications instead of just checking if the attribute responds to the method)

    April 12th, 2010 @ 01:57 PM

  5. Ernie Miller
    Ernie Miller

    Improvement to the way that I was checking for valid comparison method. Check for method in Arel::Attribute::Predicates instead of just checking if the attribute responds to the method.

    April 12th, 2010 @ 01:57 PM

  6. Ernie Miller
    Ernie Miller

    Minor improvement to the check to valid comparison methods (check that method matches a method in Arel::Attribute::Predications instead of just checking if the attribute responds to the method)

    April 12th, 2010 @ 01:57 PM

  7. Ernie Miller
    Ernie Miller
    • Tag changed from activerelation, arel, patch, predicate_builder to activerelation, arel, feature, patch, tests

    Yikes. Sorry about the multiple posts. Lighthouse was "timing out" when I was posting earlier.

    April 12th, 2010 @ 06:42 PM

  8. Ernie Miller
    Ernie Miller

    Small update to improved arel predicates.

    April 13th, 2010 @ 03:49 PM

  9. Ernie Miller
    Ernie Miller
    • Assigned user set to Pratik

    Pratik: Thanks again for the discussion today regarding this patch. Based on our talk, I've rolled the improved hash condition handling into a gem at http://github.com/ernie/meta_where.

    Please feel free to check it out and give me feedback!

    April 15th, 2010 @ 08:32 PM

  10. Rohit Arondekar
    Rohit Arondekar

    Any updates to this ticket? Does the plugin do what the patch intended to? Does this mean this ticket can be closed?

    June 16th, 2010 @ 02:32 PM

  11. Ernie Miller
    Ernie Miller

    The gem does everything described in the patch and more. See http://metautonomo.us/projects/metawhere for details. Yes, this ticket can be closed. :)

    June 16th, 2010 @ 02:35 PM

  12. Pratik
    Pratik
    • State changed from new to wontfix

    June 16th, 2010 @ 02:36 PM