Sha256: 02c397da2fe18bb32fc556a96fc50b0d8a3688825a1ce531aabe77134823652a

Contents?: true

Size: 840 Bytes

Versions: 4

Compression:

Stored size: 840 Bytes

Contents

class EditableAreasController < ApplicationController
  # PATCH/PUT /editable_area/1
	# PATCH/PUT /editable_area/1.json
  def update
    @editable_area = EditableArea.find(params[:id])
    authorize! :update, @editable_area if defined? CanCan::Ability

    respond_to do |format|
      if @editable_area.update_attributes(editable_area_params)
        format.html { redirect_to request.referrer.split('?').first, notice: 'Editable area was successfully updated.' }
        format.json { head :no_content }
      else
        format.html { redirect_to request.referrer, notice: @editable_area.errors.full_messages.join(', ') }
        format.json { render json: @editable_area.errors, status: :unprocessable_entity }
      end
    end
  end

  private

  def editable_area_params
    params.require(:editable_area).permit(:content)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
editable_areas-0.1.0 app/controllers/editable_areas_controller.rb
editable_areas-0.0.3 app/controllers/editable_areas_controller.rb
editable_areas-0.0.2 app/controllers/editable_areas_controller.rb
editable_areas-0.0.1 app/controllers/editable_areas_controller.rb