Sha256: baa39279ad5f1bed972b585d23801304d67cbc70dd5763277d2abe56e3bb152d

Contents?: true

Size: 779 Bytes

Versions: 12

Compression:

Stored size: 779 Bytes

Contents

class Pulitzer::PostTagsController < Pulitzer::ApplicationController
  before_filter :get_post, only: [:new, :create, :destroy]

  def new
    @tag_model = params[:tag_model]
    @post_tag = @post.preview_version.post_tags.new
    render partial: 'new', locals: { post: @post, tag_model: @tag_model, post_tag: @post_tag }
  end

  def create
    @post_tag = Pulitzer::CreatePostTag.new(@post, params).call
    render partial: 'show', locals: { post: @post, tag_model: @post_tag.label_type }
  end

  def destroy
    @post_tag = @post.preview_version.post_tags.find params[:id]
    @post_tag.destroy
    render nothing: true
  end

  protected

  def post_tag_params
    params[:post_tag].permit!
  end

  def get_post
    @post = Pulitzer::Post.find(params[:post_id])
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pulitzer-0.2.2 app/controllers/pulitzer/post_tags_controller.rb
pulitzer-0.2.1 app/controllers/pulitzer/post_tags_controller.rb
pulitzer-0.2.0 app/controllers/pulitzer/post_tags_controller.rb
pulitzer-0.1.10 app/controllers/pulitzer/post_tags_controller.rb
pulitzer-0.1.9 app/controllers/pulitzer/post_tags_controller.rb
pulitzer-0.1.8 app/controllers/pulitzer/post_tags_controller.rb
pulitzer-0.1.7 app/controllers/pulitzer/post_tags_controller.rb
pulitzer-0.1.6 app/controllers/pulitzer/post_tags_controller.rb
pulitzer-0.1.5 app/controllers/pulitzer/post_tags_controller.rb
pulitzer-0.1.4 app/controllers/pulitzer/post_tags_controller.rb
pulitzer-0.1.3 app/controllers/pulitzer/post_tags_controller.rb
pulitzer-0.1.2 app/controllers/pulitzer/post_tags_controller.rb