Permalink
Browse files

Fixed bug in Quoting that caused classes to be quoted incorrectly

  • Loading branch information...
1 parent fcef728 commit 12c44fe7f566990923fd0814acaa76b83309c832 @rroblak rroblak committed Mar 10, 2012
View
1 activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
@@ -34,6 +34,7 @@ def quote(value, column = nil)
when Numeric then value.to_s
when Date, Time then "'#{quoted_date(value)}'"
when Symbol then "'#{quote_string(value.to_s)}'"
+ when Class then "'#{value.to_s}'"
else
"'#{quote_string(YAML.dump(value))}'"
end
View
11 activerecord/test/cases/connection_adapters/quoting_test.rb
@@ -0,0 +1,11 @@
+module ActiveRecord
+ module ConnectionAdapters
+ module Quoting
+ class QuotingTest < ActiveRecord::TestCase
+ def test_quoting_classes
+ assert_equal "'Object'", AbstractAdapter.new(nil).quote(Object)
+ end
+ end
+ end
+ end
+end

0 comments on commit 12c44fe

Please sign in to comment.