e9_rails 0.0.13 → 0.0.14
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.
@@ -28,17 +28,32 @@ module E9Rails::ActiveRecord
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def options=(hash={})
|
31
|
-
|
31
|
+
ensuring_method_attributes do
|
32
|
+
write_attribute(options_column, hash.stringify_keys)
|
33
|
+
end
|
32
34
|
end
|
33
35
|
|
34
36
|
def options
|
35
|
-
|
36
|
-
|
37
|
-
|
37
|
+
ensuring_method_attributes do
|
38
|
+
opts = read_attribute(options_column) || {}
|
39
|
+
opts.reverse_merge! Hash[options_parameters.map(&:to_s).zip([nil])]
|
40
|
+
options_class.new(opts, self)
|
41
|
+
end
|
38
42
|
end
|
39
43
|
|
40
44
|
protected
|
41
45
|
|
46
|
+
def ensuring_method_attributes
|
47
|
+
yield
|
48
|
+
rescue
|
49
|
+
if !self.class.attribute_methods_generated?
|
50
|
+
self.class.define_attribute_methods
|
51
|
+
retry
|
52
|
+
else
|
53
|
+
raise $!
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
42
57
|
module ClassMethods
|
43
58
|
def define_method_attribute_with_inheritable_options(attr_name)
|
44
59
|
initialize_inheritable_options
|
data/lib/e9_rails/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: e9_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.14
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Travis Cox
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-05-
|
13
|
+
date: 2011-05-18 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|