diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-19 11:30:38 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-19 11:30:38 +0000 |
commit | 06b8936914bfbce092be72692d3fe2a4ff3bbe96 (patch) | |
tree | 0778a2271aff8bfaaf1b9fa124c74e3adc7dccb1 /activerecord/lib/active_record/base.rb | |
parent | 5f3f44e76fdf465910b7c6521568bb6a1e8bd641 (diff) | |
download | rails-06b8936914bfbce092be72692d3fe2a4ff3bbe96.tar.gz rails-06b8936914bfbce092be72692d3fe2a4ff3bbe96.tar.bz2 rails-06b8936914bfbce092be72692d3fe2a4ff3bbe96.zip |
Fixed that find_by_* would fail when column names had numbers #670 [demetrius]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@681 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 226db25ea3..e00f0d31bc 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -750,7 +750,7 @@ module ActiveRecord #:nodoc: def method_missing(method_id, *arguments) method_name = method_id.id2name - if method_name =~ /find_(all_by|by)_([_a-z]+)/ + if method_name =~ /find_(all_by|by)_([_a-z][_a-z\d]*)/ finder, attributes = ($1 == "all_by" ? :find_all : :find_first), $2.split("_and_") attributes.each { |attr_name| super unless column_methods_hash[attr_name.intern] } |