Commit 9a8b6530 by liyijie

resource_params is not a hash, it is an array of hash

parent e4b95145
......@@ -71,14 +71,14 @@ class SimpleController::BaseController < ::InheritedResources::Base
if params[:transition]
collection.transition do
batch_create_params.each do |resource_params|
collection.create! resource_params
collection.create!(*resource_params)
success_count += 1
end
end
else
batch_create_params.each do |resource_params|
begin
collection.create! resource_params
collection.create!(*resource_params)
success_count += 1
rescue
error_count += 1
......@@ -93,13 +93,13 @@ class SimpleController::BaseController < ::InheritedResources::Base
error_count = 0
if params[:transition]
collection.transition do
collection.where(id: params[:ids]).update! resource_params
collection.where(id: params[:ids]).update!(*resource_params)
end
success_count = collection.count
else
collection.where(id: params[:ids]).find_each do |_recourse|
collection.where(id: params[:ids]).find_each do |_resource|
begin
_recourse.update! resource_params
_resource.update!(*resource_params)
success_count += 1
rescue
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