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.
@@ -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
- case options[:format]
49
- when :json
50
- Coders::JSONColumn.new(class_name)
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
- Coders::YAMLColumn.new(class_name)
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]
@@ -1,3 +1,3 @@
1
1
  module SerializeRails
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serialize-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: