Advertisement
ktkaushik

tag_followings_controller.rb

Apr 28th, 2012
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.77 KB | None | 0 0
  1. def destroy
  2.     @tag = ActsAsTaggableOn::Tag.find_by_name(params[:name])
  3.     @tag_following = current_user.tag_followings.find_by_tag_id( @tag.id )
  4.     if @tag_following && @tag_following.destroy
  5.     logger.debug "The #{@tag} has been deleted"
  6.       @tag_unfollowed = true
  7.     else
  8.       @tag_unfollowed = false
  9.     end
  10.  
  11.     # if params[:remote]
  12.       respond_to do |format|
  13.         format.js { render 'tags/update' }
  14.         format.any {}
  15.       end
  16.     # else
  17.     #   if @tag_unfollowed
  18.     #     flash[:notice] = I18n.t('tag_followings.destroy.success', :name => params[:name])
  19.     #   else
  20.     #     flash[:error] = I18n.t('tag_followings.destroy.failure', :name => params[:name])
  21.     #   end
  22.     #   redirect_to tag_path(:name => params[:name])
  23.     # end
  24.   end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement