Skip to content

Commit

Permalink
Add methods to permit resource params
Browse files Browse the repository at this point in the history
  • Loading branch information
Brice Sanchez committed Aug 21, 2015
1 parent 57037ab commit 3a3febb
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions resources/app/controllers/refinery/admin/resources_controller.rb
Expand Up @@ -83,12 +83,26 @@ def paginate_resources(conditions = {})
def resource_params
# update only supports a single file, create supports many.
if action_name == 'update'
params.require(:resource).permit(:resource_title, :file)
params.require(:resource).permit(permitted_update_resource_params)
else
params.require(:resource).permit(:resource_title, :file => [])
params.require(:resource).permit(permitted_resource_params)
end
end

private

def permitted_resource_params
[
:resource_title, :file => []
]
end

def permitted_update_resource_params
[
:resource_title, :file
]
end

end
end
end

0 comments on commit 3a3febb

Please sign in to comment.