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.

Fix NamedScope's delegation regex

#901

NamedScope's regex is currently defined as

*snip* ...empty?|any?|respond_to?...

which breaks Object.scope.rand

I changed it to ...empty\?|any\?|respond_to\?...

Which fixes the problem. Maybe the regular expression needs to be more precise in everything though..

Reported by Jan De Poorter · August 25th, 2008 @ 11:42 AM

State: committed
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Ryan Bates
    Ryan Bates

    +1, I also think this regular expression as a whole needs to be improved or replaced with something better. But I'm not sure what that is. Any ideas?

    One possible fix for some of these problems is to put the ^ and $ outside of the parenthesis:

    
    /^(__.+|nil\?|send|object_id|...)$/
    

    But that may change some of the intended behavior.

    August 25th, 2008 @ 03:57 PM

  2. Repository
    Repository
    • State changed from new to resolved

    (from [db116a2ed688d36570f412a42e9fc33dcbca56c7]) Fix NamedScope regex so methods containing "an" get delegated to proxy_found. [#901 Fix NamedScope's delegation regex state:resolved]

    Signed-off-by: Pratik Naik pratiknaik@gmail.com http://github.com/rails/rails/co...

    August 29th, 2008 @ 02:11 PM

  3. Repository
    Repository
    • State changed from resolved to committed

    (from [c37900138c565f7dacbbfbe20f9c397da7ec49c4]) Fix NamedScope regex so methods containing "an" get delegated to proxy_found

    Signed-off-by: Michael Koziarski michael@koziarski.com [#901 Fix NamedScope's delegation regex state:committed]

    Conflicts:

    activerecord/lib/active_record/named_scope.rb
    
    

    http://github.com/rails/rails/co...

    August 29th, 2008 @ 02:25 PM