Sha256: 03638a1cdf896e259d4deec3b3ba56cdbf6b0c7cfdf2d12ebe995a04bcd1d329
Contents?: true
Size: 844 Bytes
Versions: 2
Compression:
Stored size: 844 Bytes
Contents
module Answers class Api::V1::TagsController < Answers::Api::V1::ApiController respond_to :json def index tags = ActsAsTaggableOn::Tag.all render locals: {tags: tags} end def show tag = ActsAsTaggableOn::Tag.find(params[:id]) render locals: {tag: tag} end def create tag = ActsAsTaggableOn::Tag.new(tag_params) tag.save render 'tags/show', locals: {tag: tag} end def update tag = ActsAsTaggableOn::Tag.find(params[:id]) tag.update(tag_params) render 'tags/show', locals: {tag: tag} end def destroy tag = ActsAsTaggableOn::Tag.find(params[:id]) tag.destroy render 'tags/show', locals: {tag: tag} end private def tag_params params.require(:tag).permit(:name, :taggings_count) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
answers-core-0.0.0.2 | app/controllers/answers/api/v1/tags_controller.rb |
answers-core-0.0.0 | app/controllers/answers/api/v1/tags_controller.rb |