Sha256: fb4d1479c5f5980df1468a7cf4463c711d89844c0a20d2e569280fa7c94ebfdb

Contents?: true

Size: 1.16 KB

Versions: 22

Compression:

Stored size: 1.16 KB

Contents

class Pulitzer::PostTypesController < Pulitzer::ApplicationController
  before_filter :get_post_type, only: [:show, :edit, :update, :destroy]

  def index
    @post_types = Pulitzer::PostType.all
  end

  def new
    @post_type = Pulitzer::PostType.new
    render partial: 'new', locals: {post_type: @post_type}
  end

  def create
    @post_type = Pulitzer::PostType.create(post_type_params)
    Pulitzer::CreateSingletonPost.new(@post_type, post_params_name).call
    render partial: 'show_wrapper', locals: {post_type: @post_type}
  end

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

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

  def update
    @post_type.update_attributes(post_type_params)
    Pulitzer::UpdateSingletonPost.new(@post_type, post_params_name).call
    render partial: 'show', locals: {post_type: @post_type}
  end

  def destroy
    @post_type.destroy
    render nothing: true
  end

  protected

  def post_type_params
    params[:post_type].permit!
  end

  def post_params_name
    params[:post_type][:name]
  end

  def get_post_type
    @post_type = Pulitzer::PostType.find(params[:id])
  end

end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
pulitzer-0.4.2 app/controllers/pulitzer/post_types_controller.rb
pulitzer-0.4.1 app/controllers/pulitzer/post_types_controller.rb
pulitzer-0.4.0 app/controllers/pulitzer/post_types_controller.rb
pulitzer-0.3.9 app/controllers/pulitzer/post_types_controller.rb
pulitzer-0.3.8 app/controllers/pulitzer/post_types_controller.rb
pulitzer-0.3.7 app/controllers/pulitzer/post_types_controller.rb
pulitzer-0.3.6 app/controllers/pulitzer/post_types_controller.rb
pulitzer-0.3.5 app/controllers/pulitzer/post_types_controller.rb
pulitzer-0.3.4 app/controllers/pulitzer/post_types_controller.rb
pulitzer-0.3.3 app/controllers/pulitzer/post_types_controller.rb
pulitzer-0.3.2 app/controllers/pulitzer/post_types_controller.rb
pulitzer-0.3.1 app/controllers/pulitzer/post_types_controller.rb
pulitzer-0.3.0 app/controllers/pulitzer/post_types_controller.rb
pulitzer-0.2.2 app/controllers/pulitzer/post_types_controller.rb
pulitzer-0.2.1 app/controllers/pulitzer/post_types_controller.rb
pulitzer-0.2.0 app/controllers/pulitzer/post_types_controller.rb
pulitzer-0.1.10 app/controllers/pulitzer/post_types_controller.rb
pulitzer-0.1.9 app/controllers/pulitzer/post_types_controller.rb
pulitzer-0.1.8 app/controllers/pulitzer/post_types_controller.rb
pulitzer-0.1.7 app/controllers/pulitzer/post_types_controller.rb