golden-setting 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -2
- data/app/controllers/golden/setting/settings_controller.rb +10 -1
- data/lib/golden/setting/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 382a93b828ea1126ea3c8055aa3503b06068d3ba
|
4
|
+
data.tar.gz: b05c40f13d1d1ebdeb6feab79ac0961c4855bc45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70e2597f9752dc23975f3b32938ad1c59c95dd2d96d78d6f0a2d5c42f779938b8b27df2cf971db814efb20747f5144ce64d37c7585186c29b9eaa33cddfb06fa
|
7
|
+
data.tar.gz: 17a5735be2f7280c38820a94630be4331bbd0d4e8717320532301965f59bc4db4945f26849cb568da268aef82f80b9696aa404ae763254413bd8ce9cc28e856d
|
data/README.md
CHANGED
@@ -9,8 +9,7 @@ A web interface is provied to let users can update easily.
|
|
9
9
|
For Rails 4 project, `Gemfile` should have
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem '
|
13
|
-
gem 'devise', '~> 3.0.0.rc'
|
12
|
+
gem 'devise', '> 3.0'
|
14
13
|
gem 'cancan'
|
15
14
|
gem 'simple_form', '~> 3.0.0.rc'
|
16
15
|
gem 'anjlab-bootstrap-rails', require: 'bootstrap-rails'
|
@@ -18,6 +17,14 @@ gem 'will_paginate'
|
|
18
17
|
gem 'rails-theme-helper'
|
19
18
|
```
|
20
19
|
|
20
|
+
If you add `gem 'protected_attributes'` in your `Gemfile`, remember to add
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
attr_accessible :name, :field_type, :field_values, :group
|
24
|
+
```
|
25
|
+
|
26
|
+
to your `Setting` class.
|
27
|
+
|
21
28
|
For Rails 3 project, `Gemfile` should have
|
22
29
|
|
23
30
|
```ruby
|
@@ -30,7 +30,7 @@ class Golden::Setting::SettingsController < ApplicationController
|
|
30
30
|
def update
|
31
31
|
value = params[:setting].delete :value
|
32
32
|
@setting.value = value
|
33
|
-
@setting.update_attributes
|
33
|
+
@setting.update_attributes setting_params
|
34
34
|
respond_with @setting, location: setting_path(@setting)
|
35
35
|
end
|
36
36
|
|
@@ -62,4 +62,13 @@ class Golden::Setting::SettingsController < ApplicationController
|
|
62
62
|
@setting = @setting_class.new params[:setting]
|
63
63
|
@setting.value = value
|
64
64
|
end
|
65
|
+
|
66
|
+
def setting_params
|
67
|
+
if params.respond_to? :permit
|
68
|
+
fields = [:field_type, :field_values, :group, :name, :value]
|
69
|
+
params.require(:setting).permit(fields)
|
70
|
+
else
|
71
|
+
params[:setting]
|
72
|
+
end
|
73
|
+
end
|
65
74
|
end
|