Report abuse

  def update
    #params[:map][:existing_asset_attributes] ||= {}

    @map = Map.find(params[:id])

    unless current_user.has_role?("Administrator")
      @map.approved = false
    else 
      @map.approved = true
    end 
      @map.user_id = current_user.id

    respond_to do |format|
      if @map.update_attributes(params[:map])
        flash[:notice] = @presenter.notify("notification", "Success", "Project was updated successfully.")
        format.html { redirect_to(admin_maps_path) }
        format.xml  { head :ok }
      else
  format.html { redirect_to(admin_maps_path) do |page|
          page.call :alert, "Some javascript will be my method."
        end }
        flash[:notice] = @presenter.notify("error", "Error!", "There was an error editing your project.")
        #format.html { render :action => "edit" }
        #format.xml  { render :xml => @map.errors, :status => :unprocessable_entity }
      end
    end
  end