<%= question.name%> 已创建<%= time_ago_in_words(question.created_at)%>前。
<%if:action ==“edit”then%> <%= link_to“delete”,question,:method => :删除, :confirm => “你确定?”, :title => question.name%> <%end%>
答案 0 :(得分:1)
像这样使用action_name
:
<% if action_name == 'edit' %>
<%= link_to 'delete', question, :method => :delete, :confirm => 'You sure?', :title => question.name %>
<% end %>