Permalink
Browse files

Fixed that find_by_* would fail when column names had numbers #670 [d…

…emetrius]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@681 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 5f3f44e commit 06b8936914bfbce092be72692d3fe2a4ff3bbe96 @dhh dhh committed Feb 19, 2005
Showing with 3 additions and 1 deletion.
  1. +2 −0 activerecord/CHANGELOG
  2. +1 −1 activerecord/lib/active_record/base.rb
@@ -1,5 +1,7 @@
*SVN*
+* Fixed that find_by_* would fail when column names had numbers #670 [demetrius]
+
* Fixed the SQL Server adapter on a bunch of issues #667 [DeLynn]
1. Created a new columns method that is much cleaner.
@@ -750,7 +750,7 @@ def undecorated_table_name(class_name = class_name_of_active_record_descendant(s
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] }

0 comments on commit 06b8936

Please sign in to comment.