activerecord-hstore_properties 0.0.6 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/active_record/hstore_properties.rb +6 -2
- data/lib/active_record/properties/boolean_property.rb +8 -8
- data/lib/active_record/properties/common_accessors.rb +1 -1
- data/lib/active_record/properties/counter_property.rb +4 -4
- data/lib/activerecord-hstore_properties/version.rb +1 -1
- metadata +2 -2
@@ -48,7 +48,7 @@ module ActiveRecord
|
|
48
48
|
properties.each do |property|
|
49
49
|
property.class.property_accessors.each do |suffixes, proc|
|
50
50
|
|
51
|
-
method_names = suffixes.map{|suffix| "#{property.name}#{suffix}"}
|
51
|
+
method_names = suffixes.map { |suffix| "#{property.name}#{suffix}" }
|
52
52
|
primary_method_name = method_names.shift
|
53
53
|
|
54
54
|
#Define main method once...
|
@@ -57,7 +57,11 @@ module ActiveRecord
|
|
57
57
|
end
|
58
58
|
|
59
59
|
#... and then define aliases
|
60
|
-
method_names.each
|
60
|
+
method_names.each do |method_name|
|
61
|
+
unless method_defined?(method_name)
|
62
|
+
alias_method(method_name, primary_method_name)
|
63
|
+
end
|
64
|
+
end
|
61
65
|
end
|
62
66
|
end
|
63
67
|
end
|
@@ -12,17 +12,17 @@ module ActiveRecord
|
|
12
12
|
end
|
13
13
|
|
14
14
|
add_property_accessor '_raise!', '_enable!' do |property|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
properties_will_change!
|
16
|
+
properties[property.name] = true
|
17
|
+
save
|
18
|
+
properties[property.name]
|
19
19
|
end
|
20
20
|
|
21
21
|
add_property_accessor '_lower!', '_disable!' do |property|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
properties_will_change!
|
23
|
+
properties[property.name] = false
|
24
|
+
save
|
25
|
+
properties[property.name]
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -12,10 +12,10 @@ module ActiveRecord
|
|
12
12
|
end
|
13
13
|
|
14
14
|
add_property_accessor '_bump!' do |property|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
properties_will_change!
|
16
|
+
properties[property.name] = properties[property.name].to_i + 1
|
17
|
+
save
|
18
|
+
properties[property.name]
|
19
19
|
end
|
20
20
|
|
21
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-hstore_properties
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
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: 2013-04-
|
12
|
+
date: 2013-04-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|