diff options
author | Leonardo Borges <leonardoborges.rj@gmail.com> | 2009-08-09 12:56:25 +0400 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-08-09 22:24:54 -0700 |
commit | 0c391b46fb39b697bbae1493caade23e2ddbd8a6 (patch) | |
tree | 5af5ca090d1cf4cc31b51b2f4cfd528e21d2f724 /activerecord/lib/active_record/connection_adapters/abstract | |
parent | 9c1bac0b7fcb627640db6824dca3e6e829a3c3e6 (diff) | |
download | rails-0c391b46fb39b697bbae1493caade23e2ddbd8a6.tar.gz rails-0c391b46fb39b697bbae1493caade23e2ddbd8a6.tar.bz2 rails-0c391b46fb39b697bbae1493caade23e2ddbd8a6.zip |
PostgreSQL: XML datatype support
[#1874 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb index f346e3ebc8..520f3c8c0c 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -315,6 +315,20 @@ module ActiveRecord @base = base end + #Handles non supported datatypes - e.g. XML + def method_missing(symbol, *args) + if symbol.to_s == 'xml' + xml_column_fallback(args) + end + end + + def xml_column_fallback(*args) + case @base.adapter_name.downcase + when 'sqlite', 'mysql' + options = args.extract_options! + column(args[0], :text, options) + end + end # Appends a primary key definition to the table definition. # Can be called multiple times, but this is probably not a good idea. def primary_key(name) @@ -705,3 +719,4 @@ module ActiveRecord end end + |