Skip to content

Commit

Permalink
DRY up our regular expression
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Sep 29, 2010
1 parent 10d9740 commit 1efeb5c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions activerecord/lib/active_record/dynamic_finder_match.rb
Expand Up @@ -16,9 +16,9 @@ def initialize(method)
@instantiator = nil

case method.to_s
when /^find_(all_by|last_by|by)_([_a-zA-Z]\w*)$/
@finder = :last if $1 == 'last_by'
@finder = :all if $1 == 'all_by'
when /^find_(all_|last_)?by_([_a-zA-Z]\w*)$/
@finder = :last if $1 == 'last_'
@finder = :all if $1 == 'all_'
names = $2
when /^find_by_([_a-zA-Z]\w*)\!$/
@bang = true
Expand Down

0 comments on commit 1efeb5c

Please sign in to comment.