Sha256: 8779ae675560dbd3f00a01f3790ff7a99f67d8f13c9958a815a1099343409c67

Contents?: true

Size: 1.4 KB

Versions: 13

Compression:

Stored size: 1.4 KB

Contents

class Pulitzer::ArrangementStylesController < Pulitzer::ApplicationController
  before_action :get_arrangement_style, only: [:show, :edit, :update, :destroy]

  def new
    @arrangement_style = Pulitzer::ArrangementStyle.new(arrangement_style_params)
    render partial: 'new', locals: {arrangement_style: @arrangement_style}
  end

  def create
    @arrangement_style = Pulitzer::ArrangementStyle.create(arrangement_style_params)
    if @arrangement_style.errors.empty?
      render partial: 'show_wrapper', locals: {arrangement_style: @arrangement_style}
    else
      render partial: 'new', locals: {arrangement_style: @arrangement_style}, status: 409
    end
  end

  def show
    render partial: 'show', locals: {arrangement_style: @arrangement_style}
  end

  def edit
    render partial: 'form', locals: {arrangement_style: @arrangement_style}
  end

  def update
    @arrangement_style.update_attributes(arrangement_style_params)
    if @arrangement_style.errors.empty?
      render partial: 'show', locals: {arrangement_style: @arrangement_style}
    else
      render partial: 'form', locals: {arrangement_style: @arrangement_style}, status: 409
    end
  end

  def destroy
    @arrangement_style.destroy
    head :ok
  end

  protected

  def get_arrangement_style
    @arrangement_style = Pulitzer::ArrangementStyle.find(params[:id])
  end

  def arrangement_style_params
    params[:arrangement_style].permit!
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
pulitzer-0.15.12 app/controllers/pulitzer/arrangement_styles_controller.rb
pulitzer-0.15.11 app/controllers/pulitzer/arrangement_styles_controller.rb
pulitzer-0.15.10 app/controllers/pulitzer/arrangement_styles_controller.rb
pulitzer-0.15.9 app/controllers/pulitzer/arrangement_styles_controller.rb
pulitzer-0.15.8 app/controllers/pulitzer/arrangement_styles_controller.rb
pulitzer-0.15.7 app/controllers/pulitzer/arrangement_styles_controller.rb
pulitzer-0.15.6 app/controllers/pulitzer/arrangement_styles_controller.rb
pulitzer-0.15.5 app/controllers/pulitzer/arrangement_styles_controller.rb
pulitzer-0.15.4 app/controllers/pulitzer/arrangement_styles_controller.rb
pulitzer-0.15.3 app/controllers/pulitzer/arrangement_styles_controller.rb
pulitzer-0.15.2 app/controllers/pulitzer/arrangement_styles_controller.rb
pulitzer-0.15.1 app/controllers/pulitzer/arrangement_styles_controller.rb
pulitzer-0.15.0 app/controllers/pulitzer/arrangement_styles_controller.rb