RubyMine gives en error about "Each controller action only calls one model method other than an initial find or new" which is related with "Fat Model, Skinny Controller" practice. But I do not know how can I make this code better.
Thanks for your time.
def update
@admin = Admin.find(params[:id])
if @admin.update_attributes(permitted_params)
redirect_to admins_admins_path, notice: "#{@admin.email} updated"
else
render action: "edit"
end
end
Move find
to private method:
before_action :find_admin, only: [:update]
private
def find_admin
@admin = Admin.find params[:id]
end