Class: TagFollowingsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- TagFollowingsController
- Defined in:
- app/controllers/tag_followings_controller.rb
Overview
Copyright © 2010-2011, Diaspora Inc. This file is
licensed under the Affero General Public License version 3 or later. See
the COPYRIGHT file.
Instance Method Summary collapse
-
#create ⇒ Object
POST /tag_followings POST /tag_followings.xml.
-
#destroy ⇒ Object
DELETE /tag_followings/1 DELETE /tag_followings/1.xml.
- #index ⇒ Object
- #manage ⇒ Object
Instance Method Details
#create ⇒ Object
POST /tag_followings POST /tag_followings.xml
16 17 18 19 20 21 22 23 |
# File 'app/controllers/tag_followings_controller.rb', line 16 def create tag = tag_followings_service.create(params["name"]) render json: tag.to_json, status: :created rescue TagFollowingService::DuplicateTag render json: tag_followings_service.find(params["name"]), status: :created rescue StandardError head :forbidden end |
#destroy ⇒ Object
DELETE /tag_followings/1 DELETE /tag_followings/1.xml
27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/tag_followings_controller.rb', line 27 def destroy tag_followings_service.destroy(params["id"]) respond_to do |format| format.any(:js, :json) { head :no_content } end rescue ActiveRecord::RecordNotFound respond_to do |format| format.any(:js, :json) { head :forbidden } end end |
#index ⇒ Object
39 40 41 42 43 |
# File 'app/controllers/tag_followings_controller.rb', line 39 def index respond_to do |format| format.json{ render(:json => .to_json, :status => 200) } end end |
#manage ⇒ Object
45 46 47 48 |
# File 'app/controllers/tag_followings_controller.rb', line 45 def manage redirect_to unless request.format == :mobile gon.preloads[:tagFollowings] = end |