Sha256: 518c92d73d0757cbc9ddb065da39ab78e5d254856fbc1167d996a1213d2db183

Contents?: true

Size: 1.33 KB

Versions: 18

Compression:

Stored size: 1.33 KB

Contents

module Pulitzer
  class CustomOptionsController < ApplicationController
    before_action :get_custom_option, except: [:index, :new, :create]

    def index
      @custom_options = CustomOption.all
      render_ajax
    end

    def new
      @custom_option = CustomOption.new(custom_option_params)
      render_ajax locals: { custom_option: @custom_option }
    end

    def edit
      render_ajax locals: { custom_option: @custom_option }
    end

    def show
      render_ajax locals: { custom_option: @custom_option }
    end

    def create
      @custom_option = CustomOption.new(custom_option_params)
      if @custom_option.save
        render partial: 'show_wrapper', locals: { custom_option: @custom_option }
      else
        render partial: 'new', locals: { custom_option: @custom_option }, status: 409
      end
    end

    def update
      if @custom_option.update_attributes(custom_option_params)
        render partial: 'show', locals: { custom_option: @custom_option }
      else
        render partial: 'edit', locals: { custom_option: @custom_option }, status: 409
      end
    end

    def destroy
      @custom_option.destroy
      head :ok
    end

    protected

    def custom_option_params
      params[:custom_option].permit!
    end

    def get_custom_option
      @custom_option = CustomOption.find(params[:id])
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
pulitzer-0.15.12 app/controllers/pulitzer/custom_options_controller.rb
pulitzer-0.15.11 app/controllers/pulitzer/custom_options_controller.rb
pulitzer-0.15.10 app/controllers/pulitzer/custom_options_controller.rb
pulitzer-0.15.9 app/controllers/pulitzer/custom_options_controller.rb
pulitzer-0.15.8 app/controllers/pulitzer/custom_options_controller.rb
pulitzer-0.15.7 app/controllers/pulitzer/custom_options_controller.rb
pulitzer-0.15.6 app/controllers/pulitzer/custom_options_controller.rb
pulitzer-0.15.5 app/controllers/pulitzer/custom_options_controller.rb
pulitzer-0.15.4 app/controllers/pulitzer/custom_options_controller.rb
pulitzer-0.15.3 app/controllers/pulitzer/custom_options_controller.rb
pulitzer-0.15.2 app/controllers/pulitzer/custom_options_controller.rb
pulitzer-0.15.1 app/controllers/pulitzer/custom_options_controller.rb
pulitzer-0.15.0 app/controllers/pulitzer/custom_options_controller.rb
pulitzer-0.14.4 app/controllers/pulitzer/custom_options_controller.rb
pulitzer-0.14.3 app/controllers/pulitzer/custom_options_controller.rb
pulitzer-0.14.2 app/controllers/pulitzer/custom_options_controller.rb
pulitzer-0.14.1 app/controllers/pulitzer/custom_options_controller.rb
pulitzer-0.14.0 app/controllers/pulitzer/custom_options_controller.rb