
tag_followings_controller.rb
By:
ktkaushik on
Apr 28th, 2012 | syntax:
Rails | size: 0.77 KB | hits: 21 | expires: Never
def destroy
@tag = ActsAsTaggableOn::Tag.find_by_name(params[:name])
@tag_following = current_user.tag_followings.find_by_tag_id( @tag.id )
if @tag_following && @tag_following.destroy
logger.debug "The #{@tag} has been deleted"
@tag_unfollowed = true
else
@tag_unfollowed = false
end
# if params[:remote]
respond_to do |format|
format.js { render 'tags/update' }
format.any {}
end
# else
# if @tag_unfollowed
# flash[:notice] = I18n.t('tag_followings.destroy.success', :name => params[:name])
# else
# flash[:error] = I18n.t('tag_followings.destroy.failure', :name => params[:name])
# end
# redirect_to tag_path(:name => params[:name])
# end
end