property_sets 0.3.3 → 0.3.4

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 CHANGED
@@ -1 +1 @@
1
- 0.3.3
1
+ 0.3.4
@@ -46,12 +46,6 @@ module PropertySets
46
46
  send(self.class.owner_class_sym)
47
47
  end
48
48
 
49
- def update_owner_timestamp
50
- if owner_class_instance && !owner_class_instance.new_record? && owner_class_instance.updated_at < 1.second.ago
51
- owner_class_instance.update_attribute(:updated_at, Time.now)
52
- end
53
- end
54
-
55
49
  def reset_owner_association
56
50
  owner_class_instance.send(self.class.owner_assoc).reload
57
51
  end
@@ -84,14 +78,9 @@ module PropertySets
84
78
 
85
79
  def owner_class=(owner_class)
86
80
  @owner_class_sym = owner_class.name.underscore.to_sym
87
- belongs_to owner_class_sym
81
+ belongs_to owner_class_sym, :touch => true
88
82
  validates_presence_of owner_class_sym
89
83
  validates_uniqueness_of :name, :scope => owner_class_key_sym
90
-
91
- if owner_class.table_exists? && owner_class.column_names.include?("updated_at")
92
- before_create :update_owner_timestamp
93
- before_destroy :update_owner_timestamp
94
- end
95
84
  end
96
85
 
97
86
  def owner_assoc=(association)
@@ -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.3"
8
+ s.version = "0.3.4"
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-03-01}
12
+ s.date = %q{2011-03-02}
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 = [
@@ -93,6 +93,7 @@ class TestPropertySets < ActiveSupport::TestCase
93
93
  assert record.account.id == @account.id
94
94
  end
95
95
 
96
+
96
97
  context "#set" do
97
98
  should "support writing multiple values to the association" do
98
99
  assert !@account.settings.foo?
@@ -121,6 +122,12 @@ class TestPropertySets < ActiveSupport::TestCase
121
122
  end
122
123
  end
123
124
 
125
+ should "touch the owner instance" do #Ding!
126
+ @account.expects(:touch)
127
+ record = @account.settings.lookup(:baz)
128
+ record.update_attributes!(:value => "foo")
129
+ end
130
+
124
131
  should "be updateable as AR nested attributes" do
125
132
  assert @account.texts_attributes = [{ :name => "foo", :value => "1" }, { :name => "bar", :value => "0" }]
126
133
  @account.save!
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: 21
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 3
10
- version: 0.3.3
9
+ - 4
10
+ version: 0.3.4
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-03-01 00:00:00 -08:00
18
+ date: 2011-03-02 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency