diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 4f33b96034..fbbd118640 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1924,7 +1924,7 @@ module ActiveRecord #:nodoc: end def replace_named_bind_variables(statement, bind_vars) #:nodoc: - statement.gsub(/:(\w+)/) do + statement.gsub(/:([a-zA-Z]\w*)/) do match = $1.to_sym if bind_vars.include?(match) quote_bound_value(bind_vars[match]) diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index d17712e1bf..49015133da 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -339,6 +339,8 @@ class FinderTest < ActiveRecord::TestCase def test_named_bind_variables assert_equal '1', bind(':a', :a => 1) # ' ruby-mode assert_equal '1 1', bind(':a :a', :a => 1) # ' ruby-mode + + assert_nothing_raised { bind("'+00:00'", :foo => "bar") } assert_kind_of Firm, Company.find(:first, :conditions => ["name = :name", { :name => "37signals" }]) assert_nil Company.find(:first, :conditions => ["name = :name", { :name => "37signals!" }])