simplificator-has_setting 0.3.7 → 0.3.8
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.yml +1 -1
- data/lib/has_setting/ar_extensions.rb +2 -2
- data/test/unit/has_setting_test.rb +9 -0
- metadata +2 -2
data/VERSION.yml
CHANGED
@@ -24,7 +24,8 @@ module HasSetting
|
|
24
24
|
self.class_eval do
|
25
25
|
unless @has_setting_options # define only once
|
26
26
|
# AR association to settings
|
27
|
-
has_many(:settings, :as => :owner, :class_name => 'HasSetting::Setting',
|
27
|
+
has_many( :settings, :as => :owner, :class_name => 'HasSetting::Setting',
|
28
|
+
:foreign_key => :owner_id, :dependent => :destroy)
|
28
29
|
after_save(:save_has_setting_association)
|
29
30
|
@has_setting_options = {}
|
30
31
|
def self.has_setting_options
|
@@ -40,7 +41,6 @@ module HasSetting
|
|
40
41
|
end
|
41
42
|
end
|
42
43
|
end
|
43
|
-
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -18,6 +18,15 @@ class HasSettingTest < Test::Unit::TestCase
|
|
18
18
|
assert @foo.settings.is_a?(Array)
|
19
19
|
end
|
20
20
|
|
21
|
+
def test_settings_are_destroyed
|
22
|
+
count_before = HasSetting::Setting.count
|
23
|
+
@foo.setting_1 = 10
|
24
|
+
@foo.save!
|
25
|
+
assert_equal(count_before + 1, HasSetting::Setting.count)
|
26
|
+
@foo.destroy
|
27
|
+
assert_equal(count_before, HasSetting::Setting.count)
|
28
|
+
|
29
|
+
end
|
21
30
|
|
22
31
|
def test_write_setting
|
23
32
|
count_before = HasSetting::Setting.count
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplificator-has_setting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simplificator GmbH
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-02-
|
12
|
+
date: 2009-02-06 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|