Permalink
Browse files

Fix inserting boolean values.

  • Loading branch information...
1 parent 7ffde73 commit 8c2adbfc8e30b40eff0020c951c0749a1cfccb13 @rowland committed Jan 29, 2013
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/active_record/connection_adapters/fb_adapter.rb
@@ -169,7 +169,7 @@ def simplified_type(field_type)
#
# ...you can add the following line to your <tt>environment.rb</tt> file:
#
- # ActiveRecord::ConnectionAdapters::Fb.boolean_domain = { :true => 'T', :false => 'F' }
+ # ActiveRecord::ConnectionAdapters::FbAdapter.boolean_domain = { :true => 'T', :false => 'F', :name => 'BOOLEAN', :type => 'char' }
#
# === Column Name Case Semantics
# Firebird and ActiveRecord have somewhat conflicting case semantics for
@@ -505,6 +505,12 @@ def quoted_false # :nodoc:
quote(boolean_domain[:false])
end
+ def type_cast(value, column)
+ return super unless value == true || value == false
+
+ value ? quoted_true : quoted_false
+ end
+
private
# Maps uppercase Firebird column names to lowercase for ActiveRecord;
# mixed-case columns retain their original case.

0 comments on commit 8c2adbf

Please sign in to comment.