fixed map update controller
This commit is contained in:
parent
4f8a8e2fde
commit
90f2477566
1 changed files with 7 additions and 8 deletions
|
@ -193,15 +193,14 @@ class MapsController < ApplicationController
|
|||
@current = current_user
|
||||
@map = Map.find(params[:id]).authorize_to_edit(@current)
|
||||
|
||||
if @map
|
||||
@map.name = params[:name] if params[:name]
|
||||
@map.desc = params[:desc] if params[:desc]
|
||||
@map.permission = params[:permission] if params[:permission]
|
||||
@map.save
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.json { render :json => @map }
|
||||
if !@map
|
||||
format.json { render json: "unauthorized" }
|
||||
elsif @map.update_attributes(params[:map])
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.json { render json: @map.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue