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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8b89e8764d11236ad5ca0709c5b5ce5e1e5a875
4
- data.tar.gz: b1f5aba54dc0e274f9c005f6799405aab1fa1fc6
3
+ metadata.gz: 382a93b828ea1126ea3c8055aa3503b06068d3ba
4
+ data.tar.gz: b05c40f13d1d1ebdeb6feab79ac0961c4855bc45
5
5
  SHA512:
6
- metadata.gz: 32ecf79f0dd4c2ec9d827d0a7494edca8235872d056aec8079ccc0c21bd7ab7b59fa2e6935ecdd0a585e95ab20f2e337dc743068dbcb08e3508b3bce198e2aff
7
- data.tar.gz: be0de4aead01665c0ba514d65a9496c46465b1cda82f651cdcad1249e16cfe8dd10eb678426a0948a258ed3d9bea5971a063d373c69144ddcfc8d4d8ba863913
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 'protected_attributes'
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 params[:setting]
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
@@ -1,5 +1,5 @@
1
1
  module Golden
2
2
  module Setting
3
- VERSION = '0.4.0'
3
+ VERSION = '0.5.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: golden-setting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tse-Ching Ho