Commit a6530001 by liyijie

use resource_params instead of permitted_params

parent b56a5e53
...@@ -70,15 +70,15 @@ class SimpleController::BaseController < ::InheritedResources::Base ...@@ -70,15 +70,15 @@ class SimpleController::BaseController < ::InheritedResources::Base
error_count = 0 error_count = 0
if params[:transition] if params[:transition]
collection.transition do collection.transition do
batch_create_params.each do |create_params| batch_create_params.each do |resource_params|
collection.create! create_params collection.create! resource_params
success_count += 1 success_count += 1
end end
end end
else else
batch_create_params.each do |create_params| batch_create_params.each do |resource_params|
begin begin
collection.create! create_params collection.create! resource_params
success_count += 1 success_count += 1
rescue rescue
error_count += 1 error_count += 1
...@@ -93,13 +93,13 @@ class SimpleController::BaseController < ::InheritedResources::Base ...@@ -93,13 +93,13 @@ class SimpleController::BaseController < ::InheritedResources::Base
error_count = 0 error_count = 0
if params[:transition] if params[:transition]
collection.transition do collection.transition do
collection.where(id: params[:ids]).update! permitted_params[resource_request_name] collection.where(id: params[:ids]).update! resource_params
end end
success_count = collection.count success_count = collection.count
else else
collection.where(id: params[:ids]).find_each do |_recourse| collection.where(id: params[:ids]).find_each do |_recourse|
begin begin
_recourse.update! permitted_params[resource_request_name] _recourse.update! resource_params
success_count += 1 success_count += 1
rescue rescue
error_count += 1 error_count += 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment