class CollectionsController < ApplicationController before_action :require_login def create tip_exception("勿重复收藏") if current_user.collections.find_by(create_params).present? current_user.collections.create!(create_params) normal_status("收藏成功,您可以在个人主页对应的栏目中查看") end def cancel collection = current_user.collections.find_by!(create_params) collection.destroy! normal_status("操作成功") end private def create_params params.permit(:container_id, :container_type) end end