Sha256: c187da83065ad807f8754a49730763e3908b99a7483c0e7a173d81a5784afb71

Contents?: true

Size: 1.59 KB

Versions: 2

Compression:

Stored size: 1.59 KB

Contents

class Manage::TrackableTagsController < Manage::ApplicationController
  before_action :set_trackable_tag, only: [:show, :edit, :update, :destroy]

  respond_to :html, :json

  # GET /manage/trackable_tags
  def index
    @trackable_tags = TrackableTag.all
    respond_with(:manage, @trackable_tags)
  end

  # GET /manage/trackable_tags/1
  def show
    respond_with(:manage, @trackable_tag)
  end

  # GET /manage/trackable_tags/new
  def new
    @trackable_tag = TrackableTag.new
    respond_with(:manage, @questionnaire)
  end

  # GET /manage/trackable_tags/1/edit
  def edit
  end

  # POST /manage/trackable_tags
  def create
    @trackable_tag = TrackableTag.new(trackable_tag_params)

    if @trackable_tag.save
      flash[:notice] = 'Trackable tag was successfully created.'
      respond_with(:manage, @trackable_tag)
    else
      render :new
    end
  end

  # PATCH/PUT /manage/trackable_tags/1
  def update
    if @trackable_tag.update(trackable_tag_params)
      flash[:notice] = 'Trackable tag was successfully updated.'
      respond_with(:manage, @trackable_tag)
    else
      render :edit
    end
  end

  # DELETE /manage/trackable_tags/1
  def destroy
    @trackable_tag.destroy
    flash[:notice] = 'Trackable tag was successfully destroyed.'
    respond_with(:manage, @trackable_tag)
  end

  private

  # Use callbacks to share common setup or constraints between actions.
  def set_trackable_tag
    @trackable_tag = TrackableTag.find(params[:id])
  end

  # Only allow a trusted parameter "white list" through.
  def trackable_tag_params
    params.require(:trackable_tag).permit(:name)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hackathon_manager-0.11.1 app/controllers/manage/trackable_tags_controller.rb
hackathon_manager-0.11.0 app/controllers/manage/trackable_tags_controller.rb