Rails: How to determine controller/action in view

前端 未结 5 1562
半阙折子戏
半阙折子戏 2021-01-31 17:10

This is my form partial:

<%= f.simple_fields_for :photo_attributes, :html => { :multipart => true } do |d| %>
    <%= d.label :image, :label =>         


        
5条回答
  •  醉话见心
    2021-01-31 17:41

    Rails 5: Display Action within the view

    <%= action_name %>
    

    If statement within the view

    <% if action_name == "edit" %>
      This is an edit action.
    <% end %>
    

提交回复
热议问题