6
4

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 5 years have passed since last update.

特定のページでビューの一部を非表示にする方法

Posted at

URLが"sign_in"という文字を含む時、link_toを非表示

表示中のページURL: http://localhost:3000/users/sign_in

hoge.rb

- unless request.path.include?("sign_in")
# URLが"sing_in"をいう文字を[含まない時]、次の処理を実行

  = link_to "サインイン", new_user_session_path

# つまり、"sing_in"をいう文字を含む時、下の処理は実行しない(表示しない)
6
4
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
6
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?