serialize-rails 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/serialize-rails/serialization.rb +10 -8
- data/lib/serialize-rails/version.rb +1 -1
- metadata +1 -1
@@ -45,16 +45,18 @@ module ActiveRecord
|
|
45
45
|
coder = if [:load, :dump].all? { |x| class_name.respond_to?(x) }
|
46
46
|
class_name
|
47
47
|
else
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
when :marshal
|
52
|
-
Coders::MarshalColumn.new(class_name)
|
53
|
-
when :xml
|
54
|
-
Coders::XMLColumn.new(class_name, options[:ox_options])
|
48
|
+
upcase_formats = [:json, :xml, :yaml]
|
49
|
+
coder_class = if upcase_formats.include?(options[:format])
|
50
|
+
options[:format].to_s.upcase
|
55
51
|
else
|
56
|
-
|
52
|
+
options[:format].to_s.camelize
|
57
53
|
end
|
54
|
+
coder_class = begin
|
55
|
+
"ActiveRecord::Coders::#{coder_class}Column".constantize
|
56
|
+
rescue
|
57
|
+
Coders::YAMLColumn
|
58
|
+
end
|
59
|
+
coder_class.new(class_name)
|
58
60
|
end
|
59
61
|
|
60
62
|
coder = Coders::GzipColumn.new(coder) if options[:gzip]
|