activerecord-hstore_properties 0.0.5 → 0.0.6
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/activerecord-hstore_properties.gemspec +1 -1
- data/lib/active_record/hstore_properties.rb +2 -2
- data/lib/active_record/properties/base.rb +5 -1
- data/lib/active_record/properties/common_accessors.rb +1 -1
- data/lib/active_record/properties/counter_property.rb +2 -2
- data/lib/activerecord-hstore_properties/version.rb +1 -1
- data/spec/hstore_properties_spec.rb +2 -0
- metadata +2 -2
@@ -9,7 +9,7 @@ Gem::Specification.new do |gem|
|
|
9
9
|
gem.authors = ["stevo"]
|
10
10
|
gem.email = ["blazej.kosmowski@selleo.com"]
|
11
11
|
gem.homepage = "https://github.com/stevo/activerecord-hstore_properties"
|
12
|
-
gem.summary = "
|
12
|
+
gem.summary = "hStore-based model properties on steroids!"
|
13
13
|
gem.description = "Allows to describe field names that will be stored within hstore column together with their types. Data can then be retrieved with a set of helpful getters."
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
@@ -63,9 +63,9 @@ module ActiveRecord
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def extract_properties(args)
|
66
|
-
typed_properties = args.extract_options
|
66
|
+
typed_properties = args.extract_options!.stringify_keys
|
67
67
|
|
68
|
-
result = args.map { |property| default_property_klass.new(property) }
|
68
|
+
result = args.map { |property| default_property_klass.new(property.to_s) }
|
69
69
|
typed_properties.each do |property, _type|
|
70
70
|
result << "active_record/properties/#{_type.to_s}_property".camelize.constantize.new(property)
|
71
71
|
end
|
@@ -12,8 +12,8 @@ module ActiveRecord
|
|
12
12
|
end
|
13
13
|
|
14
14
|
add_property_accessor '_bump!' do |property|
|
15
|
-
_properties =
|
16
|
-
_properties[property.name] =
|
15
|
+
_properties = properties
|
16
|
+
_properties[property.name] = properties[property.name].to_i + 1
|
17
17
|
update_column(:properties, ActiveRecord::Coders::Hstore.new({}).dump(_properties))
|
18
18
|
_properties[property.name]
|
19
19
|
end
|
@@ -96,6 +96,8 @@ describe ActiveRecord::HstoreProperties do
|
|
96
96
|
it "should be possible to bump counter" do
|
97
97
|
@comment.property_two_bump!
|
98
98
|
@comment.properties['property_two'].should == '1'
|
99
|
+
@comment.property_two_bump!
|
100
|
+
@comment.properties['property_two'].should == '2'
|
99
101
|
end
|
100
102
|
|
101
103
|
it "should be possible to query for current count" do
|
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.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -191,7 +191,7 @@ rubyforge_project:
|
|
191
191
|
rubygems_version: 1.8.24
|
192
192
|
signing_key:
|
193
193
|
specification_version: 3
|
194
|
-
summary:
|
194
|
+
summary: hStore-based model properties on steroids!
|
195
195
|
test_files:
|
196
196
|
- spec/hstore_properties_spec.rb
|
197
197
|
- spec/spec_helper.rb
|