Sha256: 265af0f5e36d91825f502140d4f895ac16b70f44003bfcff2ec19a1cd580c05b

Contents?: true

Size: 1.38 KB

Versions: 19

Compression:

Stored size: 1.38 KB

Contents

class Pulitzer::BackgroundStylesController < Pulitzer::ApplicationController
  before_action :get_background_style, only: [:show, :edit, :update, :destroy]

  def new
    @background_style = Pulitzer::BackgroundStyle.new(background_style_params)
    render partial: 'new', locals: {background_style: @background_style}
  end

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

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

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

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

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

  protected

  def get_background_style
    @background_style = Pulitzer::BackgroundStyle.find(params[:id])
  end

  def background_style_params
    params[:background_style].permit!
  end

end

Version data entries

19 entries across 19 versions & 1 rubygems

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