LoginSignup
6
4

More than 5 years have passed since last update.

rails5 viewでアクションによって条件分岐させたい場合

Last updated at Posted at 2018-03-16
new.html.haml
- if controller.action_name == "new" ## newアクションの場合
   
- else                               ## newアクション以外の場合
   

controller.action_nameで、アクション名を参照できる。

参考
controller.controller_nameで、コントローラー名を参照できる。

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