Sha256: a8f740720a1456411b36d37aaa74606831cf89d79aae12067c9300d40bb9f73e

Contents?: true

Size: 983 Bytes

Versions: 1

Compression:

Stored size: 983 Bytes

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)
    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)
    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 get_post_type
    @post_type = Pulitzer::PostType.find(params[:id])
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pulitzer-0.0.1 app/controllers/pulitzer/post_types_controller.rb