property_sets 0.3.2 → 0.3.3
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/VERSION +1 -1
- data/lib/property_sets/active_record_extension.rb +1 -1
- data/property_sets.gemspec +2 -2
- data/test/test_property_sets.rb +6 -0
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.3
|
@@ -64,7 +64,7 @@ module PropertySets
|
|
64
64
|
# The finder method which returns the property if present, otherwise a new instance with defaults
|
65
65
|
define_method "lookup" do |arg|
|
66
66
|
instance = detect { |property| property.name.to_sym == arg }
|
67
|
-
instance ||= property_class.new(:name => arg.to_s, :value => property_class.default(arg))
|
67
|
+
instance ||= property_class.new(@owner.class.name.underscore.to_sym => @owner, :name => arg.to_s, :value => property_class.default(arg))
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
data/property_sets.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{property_sets}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Morten Primdahl"]
|
12
|
-
s.date = %q{2011-01
|
12
|
+
s.date = %q{2011-03-01}
|
13
13
|
s.description = %q{This gem is an ActiveRecord extension which provides a convenient interface for managing per row properties}
|
14
14
|
s.email = %q{morten@zendesk.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/test/test_property_sets.rb
CHANGED
@@ -87,6 +87,12 @@ class TestPropertySets < ActiveSupport::TestCase
|
|
87
87
|
assert @account.settings.foo.nil?
|
88
88
|
end
|
89
89
|
|
90
|
+
should "reference the owner instance when constructing a new record" do
|
91
|
+
record = @account.settings.lookup(:baz)
|
92
|
+
assert record.new_record?
|
93
|
+
assert record.account.id == @account.id
|
94
|
+
end
|
95
|
+
|
90
96
|
context "#set" do
|
91
97
|
should "support writing multiple values to the association" do
|
92
98
|
assert !@account.settings.foo?
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: property_sets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 3
|
10
|
+
version: 0.3.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Morten Primdahl
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01
|
18
|
+
date: 2011-03-01 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|