Skip to content

Commit

Permalink
Update permitted params from master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
miks committed Apr 18, 2015
1 parent 7f58b92 commit b45cb51
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions releaf-core/app/controllers/releaf/base_controller.rb
Expand Up @@ -72,7 +72,7 @@ def create

def update
prepare_update
result = @resource.update_attributes required_params.permit(*resource_params)
result = @resource.update_attributes(resource_params)
respond_after_save(:update, result, "edit")
end

Expand Down Expand Up @@ -346,7 +346,7 @@ def prepare_new
def prepare_create
# load resource only if is not loaded yet
@resource = resource_class.new unless resource_given?
@resource.assign_attributes required_params.permit(*resource_params)
@resource.assign_attributes(resource_params)
end

def prepare_edit
Expand Down Expand Up @@ -476,10 +476,14 @@ def setup
@resources_per_page = 40
end

def resource_params
required_params.permit(*permitted_params)
end

# Returns which resource attributes can be updated with mass assignment.
#
# The resulting array will be passed to strong_parameters ``permit``
def resource_params
def permitted_params
return unless mass_assigment_action?

cols = resource_class.column_names.dup - %w{id created_at updated_at}
Expand Down

0 comments on commit b45cb51

Please sign in to comment.