0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ログインIDで販売済み商品選択の場合トップページへ遷移させる

Last updated at Posted at 2021-04-29

この場合はログインIDの確認とpurchaseテーブルにitem_idがあるかどうかを条件分岐させるだけ

purchasecontroller.rb
  def set_redirect_to_root2
    if user_signed_in?
      if Purchase.exists?(item_id: params[:item_id])
        redirect_to root_path
      end
    end
  end
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?