mamechiwa 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mamechiwa/version.rb +1 -1
- data/lib/mamechiwa.rb +10 -6
- metadata +2 -2
data/lib/mamechiwa/version.rb
CHANGED
data/lib/mamechiwa.rb
CHANGED
@@ -36,13 +36,13 @@ module Mamechiwa
|
|
36
36
|
end
|
37
37
|
|
38
38
|
define_method "#{field}=" do |value|
|
39
|
-
if value.is_a?(Hash)
|
40
|
-
write_attribute("#{field}", value.to_json)
|
41
|
-
else
|
42
|
-
write_attribute("#{field}", value)
|
43
|
-
end
|
44
|
-
|
45
39
|
initialize_with_mame
|
40
|
+
|
41
|
+
hash = value
|
42
|
+
hash = ActiveSupport::JSON.decode(value) if value.is_a?(String)
|
43
|
+
write_attribute("#{field}", @mame_embedded.merge(hash).to_json)
|
44
|
+
|
45
|
+
@mame_embedded.refresh
|
46
46
|
end
|
47
47
|
|
48
48
|
define_method "#{field}" do
|
@@ -109,6 +109,10 @@ module Mamechiwa
|
|
109
109
|
@mame_parent = parent
|
110
110
|
@mame_parent_field = field
|
111
111
|
|
112
|
+
refresh
|
113
|
+
end
|
114
|
+
|
115
|
+
def refresh
|
112
116
|
value = @mame_parent.send(:read_attribute, @mame_parent_field)
|
113
117
|
|
114
118
|
mame_attrs.each do |attr|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mamechiwa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|