active_record_serialize_json 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGES CHANGED
@@ -1,3 +1,5 @@
1
+ 2011-03-21 - 0.0.2
2
+ * Use ActiveRecord::Base API methods to get/set attributes.
1
3
  2010-08-19 - 0.0.1
2
4
  * Added some necessary dependencies
3
5
  * Support for more than one attribute
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -1,7 +1,7 @@
1
1
  module ActiveRecord
2
2
  module SerializeJSON
3
3
  # ActiveRecord::SerializeJSON version
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
6
6
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
7
7
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -13,20 +13,20 @@ module ActiveRecord
13
13
 
14
14
  def before_save(record)
15
15
  json = serialize record
16
- record.__send__(:"#{@attribute}=", json)
16
+ record.write_attribute(@attribute, json)
17
17
  end
18
18
 
19
19
  def after_save(record)
20
20
  data = deserialize record
21
- record.__send__(:"#{@attribute}=", data)
21
+ record.write_attribute(@attribute, data)
22
22
  end
23
23
 
24
24
  def serialize(record)
25
- self.class.serialize(record.__send__(@attribute), @serialize)
25
+ self.class.serialize(record.read_attribute(@attribute), @serialize)
26
26
  end
27
27
 
28
28
  def deserialize(record)
29
- self.class.deserialize(record.__send__(@attribute), @deserialize)
29
+ self.class.deserialize(record.read_attribute(@attribute), @deserialize)
30
30
  end
31
31
 
32
32
  def self.serialize(value, opts = {})
@@ -60,7 +60,7 @@ module ActiveRecord
60
60
  define_method(:after_find) do
61
61
  super if defined? super
62
62
  self.class.serialize_json_attributes.each do |attribute, sj|
63
- __send__(:"#{attribute}=", sj.deserialize(self))
63
+ write_attribute(attribute, sj.deserialize(self))
64
64
  end
65
65
  end
66
66
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_serialize_json
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 27
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 0
8
- - 1
9
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Florian Frank
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-08-24 00:00:00 +02:00
18
+ date: 2011-03-21 00:00:00 +01:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: json
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ~>
26
28
  - !ruby/object:Gem::Version
29
+ hash: 7
27
30
  segments:
28
31
  - 1
29
32
  - 4
@@ -34,9 +37,11 @@ dependencies:
34
37
  name: activerecord
35
38
  prerelease: false
36
39
  requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
37
41
  requirements:
38
42
  - - ~>
39
43
  - !ruby/object:Gem::Version
44
+ hash: 5
40
45
  segments:
41
46
  - 2
42
47
  - 3
@@ -73,23 +78,27 @@ rdoc_options:
73
78
  require_paths:
74
79
  - lib
75
80
  required_ruby_version: !ruby/object:Gem::Requirement
81
+ none: false
76
82
  requirements:
77
83
  - - ">="
78
84
  - !ruby/object:Gem::Version
85
+ hash: 3
79
86
  segments:
80
87
  - 0
81
88
  version: "0"
82
89
  required_rubygems_version: !ruby/object:Gem::Requirement
90
+ none: false
83
91
  requirements:
84
92
  - - ">="
85
93
  - !ruby/object:Gem::Version
94
+ hash: 3
86
95
  segments:
87
96
  - 0
88
97
  version: "0"
89
98
  requirements: []
90
99
 
91
100
  rubyforge_project: active_record_serialize_json
92
- rubygems_version: 1.3.6
101
+ rubygems_version: 1.3.7
93
102
  signing_key:
94
103
  specification_version: 3
95
104
  summary: Serialize an ActiveRecord::Base attribute via JSON