cruj_cruj_cruj 0.0.13 → 0.0.14

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: a2df51e8f2e2414b6bc3938652145cbd49fff233
4
- data.tar.gz: de597b7d91346c5e33388b7124ab652ba133d312
3
+ metadata.gz: 650f80cdadc83ce5ac92c19fe4a5c1f2ee6b091d
4
+ data.tar.gz: d8e32fd1285fad8bc61567690366aefb6bb2377f
5
5
  SHA512:
6
- metadata.gz: ecf6ed42f5d0ed73f125a825749ad4bccfed68ca5ff37b29fb39b3a3e69eede92535ba9233845ef4dbd6ae1d7f1890cc26336e088aec935ceb2fbc964763ab28
7
- data.tar.gz: f650d26eac8ba800d441d1e7314ad27c877d6a39b15714449fcdab59fbbd055b31cc0d6e1860f0afab6050f661c24b21d2b574ce56380e6208e368ca51143004
6
+ metadata.gz: 09ea6309a91fa3fb3f72669a4f97482fddc4251c9e0a60fd5128ce0bc761f9ea204c3710af8ea0cc096dfba14881d23aab3afb0d275cc73a96c03d2323a67cfe
7
+ data.tar.gz: de74aea8c58ae7835e39ad502985d7e842f5baeddf4927a40425cbaf4e0c70b9104d2563dcbab1e6d70ebb42ba877f01218cc62cec767dbfa7aa9e15ef1e4c43
@@ -33,7 +33,7 @@ class CrujCrujCrujController < ApplicationController
33
33
  def edit; end
34
34
 
35
35
  def update
36
- if @resource.update_attributes(params[snake_case_model_name])
36
+ if @resource.update_attributes(safe_parameters)
37
37
  redirect_to(action: :index, notice: l("#{snake_case_model_name}_edit_success_message"))
38
38
  else
39
39
  render action: 'edit'
@@ -86,7 +86,11 @@ class CrujCrujCrujController < ApplicationController
86
86
  end
87
87
 
88
88
  def build_resource
89
- @resource = model_class.new(params[snake_case_model_name])
89
+ @resource = model_class.new(safe_parameters)
90
+ end
91
+
92
+ def safe_parameters
93
+ params.require(snake_case_model_name).permit!
90
94
  end
91
95
 
92
96
  def find_resource
@@ -108,7 +112,11 @@ class CrujCrujCrujController < ApplicationController
108
112
  end
109
113
 
110
114
  def model_name
111
- self.class.name.sub(/Controller$/, '').singularize
115
+ if @resource
116
+ @resource.class.name
117
+ else
118
+ self.class.name.sub(/Controller$/, '').singularize
119
+ end
112
120
  end
113
121
 
114
122
  def model_class
@@ -1,3 +1,3 @@
1
1
  module CrujCrujCruj
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cruj_cruj_cruj
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Campos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-13 00:00:00.000000000 Z
11
+ date: 2016-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails