real_settings 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -4
- data/lib/real_settings/relations.rb +2 -2
- data/lib/real_settings/version.rb +1 -1
- data/spec/real_settings_spec.rb +7 -8
- metadata +8 -2
data/README.md
CHANGED
@@ -34,8 +34,8 @@ Run install command and migrate database:
|
|
34
34
|
Settings.config do
|
35
35
|
settings.app_name = "My Application Name"
|
36
36
|
settings.app_url = "http://www.my-application.com"
|
37
|
-
default_meta_keywords = "default meta keywords"
|
38
|
-
default_meta_description = "default meta description"
|
37
|
+
settings.default_meta_keywords = "default meta keywords"
|
38
|
+
settings.default_meta_description = "default meta description"
|
39
39
|
# add some settings here
|
40
40
|
end
|
41
41
|
```
|
@@ -58,8 +58,8 @@ Settings.app_name # => "real_settings"
|
|
58
58
|
Settings.config do
|
59
59
|
settings.app_name = "My Application Name"
|
60
60
|
settings.app_url = "http://www.my-application.com"
|
61
|
-
default_meta_keywords = "default meta keywords"
|
62
|
-
default_meta_description = "default meta description"
|
61
|
+
settings.default_meta_keywords = "default meta keywords"
|
62
|
+
settings.default_meta_description = "default meta description"
|
63
63
|
......
|
64
64
|
end
|
65
65
|
|
@@ -7,8 +7,8 @@ ActiveRecord::Base.class_eval do
|
|
7
7
|
def settings
|
8
8
|
OwnerSettings.get_settings(self, __default_settings_options)
|
9
9
|
end
|
10
|
-
|
11
|
-
after_destroy {
|
10
|
+
after_save {|owner| owner.settings.save!}
|
11
|
+
after_destroy {|owner| owner.settings.target_settings.each {|s| s.destroy}}
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
data/spec/real_settings_spec.rb
CHANGED
@@ -30,7 +30,6 @@ describe "RealSettings" do
|
|
30
30
|
Settings.app_name.should == 'new name'
|
31
31
|
Settings.reload!
|
32
32
|
Settings.app_name.should == @app_name
|
33
|
-
|
34
33
|
end
|
35
34
|
|
36
35
|
it "load default settings from database" do
|
@@ -93,7 +92,7 @@ describe "RealSettings" do
|
|
93
92
|
@user1.settings.reload!
|
94
93
|
@user1.settings.editor.should == nil
|
95
94
|
@user1.settings.editor = 'textmate'
|
96
|
-
@user1.
|
95
|
+
@user1.save!
|
97
96
|
@user1.settings.reload!
|
98
97
|
@user1.settings.editor.should == 'textmate'
|
99
98
|
|
@@ -103,7 +102,7 @@ describe "RealSettings" do
|
|
103
102
|
it "user has same settings with global settings" do
|
104
103
|
@user1.settings.app_name.should == nil
|
105
104
|
@user1.settings.app_name = 'app name for user'
|
106
|
-
@user1.
|
105
|
+
@user1.save!
|
107
106
|
@user1.settings.app_name.should == 'app name for user'
|
108
107
|
Settings.app_name.should == @app_name
|
109
108
|
end
|
@@ -120,8 +119,8 @@ describe "RealSettings" do
|
|
120
119
|
|
121
120
|
@user1.settings.editor = 'textmate'
|
122
121
|
@user2.settings.editor = 'vim'
|
123
|
-
@user1.
|
124
|
-
@user2.
|
122
|
+
@user1.save!
|
123
|
+
@user2.save!
|
125
124
|
@user1.settings.editor.should == 'textmate'
|
126
125
|
@user2.settings.editor.should == 'vim'
|
127
126
|
end
|
@@ -129,7 +128,7 @@ describe "RealSettings" do
|
|
129
128
|
it "diferent users have different settings" do
|
130
129
|
@user1.settings.editor = 'textmate'
|
131
130
|
@user2.settings.editor.should == nil
|
132
|
-
@user1.
|
131
|
+
@user1.save!
|
133
132
|
@user2.settings.editor.should == nil
|
134
133
|
end
|
135
134
|
|
@@ -149,7 +148,7 @@ describe "RealSettings" do
|
|
149
148
|
|
150
149
|
@user1.settings.notebook = 'Macbook Air'
|
151
150
|
@user1.settings.mobile = 'iPhone 4S'
|
152
|
-
@user1.
|
151
|
+
@user1.save!
|
153
152
|
@user1.settings.notebook.should == 'Macbook Air'
|
154
153
|
@user1.settings.mobile.should == 'iPhone 4S'
|
155
154
|
@user1.settings.reload!
|
@@ -162,7 +161,7 @@ describe "RealSettings" do
|
|
162
161
|
|
163
162
|
it "be sure destroy settings after destroy user" do
|
164
163
|
@user1.settings.new_feature = "new setting for user"
|
165
|
-
@user1.
|
164
|
+
@user1.save!
|
166
165
|
@user1.destroy
|
167
166
|
Settings.where(:key => 'new_feature').all.should be_empty
|
168
167
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: real_settings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
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: 2012-
|
12
|
+
date: 2012-11-27 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A real settings tool for Rails3
|
15
15
|
email:
|
@@ -49,12 +49,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
49
49
|
- - ! '>='
|
50
50
|
- !ruby/object:Gem::Version
|
51
51
|
version: '0'
|
52
|
+
segments:
|
53
|
+
- 0
|
54
|
+
hash: -3229865968002796882
|
52
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
56
|
none: false
|
54
57
|
requirements:
|
55
58
|
- - ! '>='
|
56
59
|
- !ruby/object:Gem::Version
|
57
60
|
version: '0'
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
hash: -3229865968002796882
|
58
64
|
requirements: []
|
59
65
|
rubyforge_project:
|
60
66
|
rubygems_version: 1.8.24
|