Sha256: 391ee2206497b3d132b6f154d08469778c9233e9c7ca7d19540990318c8dda42

Contents?: true

Size: 1.46 KB

Versions: 13

Compression:

Stored size: 1.46 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
  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

13 entries across 13 versions & 1 rubygems

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