Class: Blog::TagsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Blog::TagsController
- Defined in:
- app/controllers/blog/tags_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /tags.
-
#destroy ⇒ Object
DELETE /tags/1.
-
#index ⇒ Object
GET /tags.
-
#show ⇒ Object
GET /tags/1.
-
#update ⇒ Object
PATCH/PUT /tags/1.
Instance Method Details
#create ⇒ Object
POST /tags
16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/blog/tags_controller.rb', line 16 def create @tag = Tag.new(tag_params) if @tag.save render json: @tag, status: :created else render json: @tag.errors, status: :unprocessable_entity end end |
#destroy ⇒ Object
DELETE /tags/1
36 37 38 39 |
# File 'app/controllers/blog/tags_controller.rb', line 36 def destroy @tag.destroy render json: { success: true } end |
#index ⇒ Object
GET /tags
6 7 8 |
# File 'app/controllers/blog/tags_controller.rb', line 6 def index render json: Tag.all end |
#show ⇒ Object
GET /tags/1
11 12 13 |
# File 'app/controllers/blog/tags_controller.rb', line 11 def show render json: @tag end |
#update ⇒ Object
PATCH/PUT /tags/1
27 28 29 30 31 32 33 |
# File 'app/controllers/blog/tags_controller.rb', line 27 def update if @tag.update(tag_params) render json: @tag else render json: @tag.errors, status: :unprocessable_entity end end |