action_args 1.5.1 → 1.5.2
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.
- checksums.yaml +4 -4
- data/lib/action_args/params_handler.rb +1 -1
- data/lib/action_args/version.rb +1 -1
- data/spec/controllers/strong_parameters_spec.rb +6 -0
- data/spec/fake_app.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc3c3e13a176e31e7bd8cd5fef3f81ad07ec90e1
|
4
|
+
data.tar.gz: 2a9c273f4ff29a1648f5c7668480d9d89a38edce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66054d421bd9685f970bbe57aeb2337013e2e46dbb062ac46aa2a702b5f20ecb910a0a26294f7f07ca502c1c82974ce045fcf9fa61bb00aa528fd21171b42752
|
7
|
+
data.tar.gz: 4c124ceb79d14182f86fad1fc6fb4b3cda4c3ef2dc75dab8f4d3ad8b974a253d097524eddaae879139f78defa0514d89c5e3eed0c58a5fef90d503d92b563245
|
@@ -39,7 +39,7 @@ module ActionArgs
|
|
39
39
|
# permits declared model attributes in the params Hash
|
40
40
|
# note that this method mutates the given params Hash
|
41
41
|
def self.strengthen_params!(controller_class, method_parameters, params)
|
42
|
-
target_model_name = (controller_class.instance_variable_get(:'@permitting_model_name') || controller_class.name.sub(/.+::/, '').sub(/Controller$/, '')).singularize.underscore.to_sym
|
42
|
+
target_model_name = (controller_class.instance_variable_get(:'@permitting_model_name') || controller_class.name.sub(/.+::/, '').sub(/Controller$/, '')).singularize.underscore.tr('/', '_').to_sym
|
43
43
|
permitted_attributes = controller_class.instance_variable_get :'@permitted_attributes'
|
44
44
|
|
45
45
|
method_parameters.each do |type, key|
|
data/lib/action_args/version.rb
CHANGED
data/spec/fake_app.rb
CHANGED
@@ -22,6 +22,7 @@ ActionArgsTestApp::Application.routes.draw do
|
|
22
22
|
resources :stores
|
23
23
|
|
24
24
|
namespace :admin do
|
25
|
+
resources :accounts
|
25
26
|
resources :books
|
26
27
|
end
|
27
28
|
end
|
@@ -33,6 +34,11 @@ class Book < ActiveRecord::Base
|
|
33
34
|
end
|
34
35
|
class Store < ActiveRecord::Base
|
35
36
|
end
|
37
|
+
module Admin
|
38
|
+
def self.table_name_prefix() 'admin_' end
|
39
|
+
class Account < ActiveRecord::Base
|
40
|
+
end
|
41
|
+
end
|
36
42
|
|
37
43
|
# mailers
|
38
44
|
require "action_mailer/railtie"
|
@@ -123,6 +129,15 @@ if Rails::VERSION::MAJOR >= 4
|
|
123
129
|
end
|
124
130
|
end
|
125
131
|
module Admin
|
132
|
+
class AccountsController < ::ApplicationController
|
133
|
+
permits :name, model_name: 'Admin::Account'
|
134
|
+
|
135
|
+
def create(admin_account)
|
136
|
+
@admin_account = Admin::Account.create! admin_account
|
137
|
+
render text: @admin_account.name
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
126
141
|
class BooksController < ::ApplicationController
|
127
142
|
permits :title
|
128
143
|
|
@@ -143,5 +158,6 @@ class CreateAllTables < ActiveRecord::Migration
|
|
143
158
|
create_table(:authors) {|t| t.string :name}
|
144
159
|
create_table(:books) {|t| t.string :title; t.integer :price}
|
145
160
|
create_table(:stores) {|t| t.string :name; t.string :url}
|
161
|
+
create_table(:admin_accounts) {|t| t.string :name}
|
146
162
|
end
|
147
163
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_args
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akira Matsuda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|