Sha256: cecfbe706011d9b6a208767b98c0c46c5be1d085cba9ea93a957278d7f2e2c6a

Contents?: true

Size: 1.48 KB

Versions: 19

Compression:

Stored size: 1.48 KB

Contents

class Pulitzer::JustificationStylesController < Pulitzer::ApplicationController
  before_action :get_justification_style, only: [:show, :edit, :update, :destroy]

  def new
    @justification_style = Pulitzer::JustificationStyle.new(justification_style_params)
    render partial: 'new', locals: {justification_style: @justification_style}
  end

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

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

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

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

  def destroy
    @justification_style.destroy
    head :ok and return
  end

  protected

  def get_justification_style
    @justification_style = Pulitzer::JustificationStyle.find(params[:id])
  end

  def justification_style_params
    params[:justification_style].permit!
  end

end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
pulitzer-0.15.31 app/controllers/pulitzer/justification_styles_controller.rb
pulitzer-0.15.30 app/controllers/pulitzer/justification_styles_controller.rb
pulitzer-0.15.29 app/controllers/pulitzer/justification_styles_controller.rb
pulitzer-0.15.28 app/controllers/pulitzer/justification_styles_controller.rb
pulitzer-0.15.27 app/controllers/pulitzer/justification_styles_controller.rb
pulitzer-0.15.26 app/controllers/pulitzer/justification_styles_controller.rb
pulitzer-0.15.25 app/controllers/pulitzer/justification_styles_controller.rb
pulitzer-0.15.24 app/controllers/pulitzer/justification_styles_controller.rb
pulitzer-0.15.23 app/controllers/pulitzer/justification_styles_controller.rb
pulitzer-0.15.22 app/controllers/pulitzer/justification_styles_controller.rb
pulitzer-0.15.21 app/controllers/pulitzer/justification_styles_controller.rb
pulitzer-0.15.20 app/controllers/pulitzer/justification_styles_controller.rb
pulitzer-0.15.19 app/controllers/pulitzer/justification_styles_controller.rb
pulitzer-0.15.18 app/controllers/pulitzer/justification_styles_controller.rb
pulitzer-0.15.17 app/controllers/pulitzer/justification_styles_controller.rb
pulitzer-0.15.16 app/controllers/pulitzer/justification_styles_controller.rb
pulitzer-0.15.15 app/controllers/pulitzer/justification_styles_controller.rb
pulitzer-0.15.14 app/controllers/pulitzer/justification_styles_controller.rb
pulitzer-0.15.13 app/controllers/pulitzer/justification_styles_controller.rb