在rails 3.0中我想在节目和编辑中使用局部视图,为了编辑,我想显示要删除的链接

时间:2011-01-15 01:55:01

标签: ruby-on-rails-3

       <%= question.name%>            已创建<%= time_ago_in_words(question.created_at)%>前。        

<%if:action ==“edit”then%>        <%= link_to“delete”,question,:method => :删除,                                      :confirm => “你确定?”,                                      :title => question.name%>      <%end%>  

1 个答案:

答案 0 :(得分:1)

像这样使用action_name

<% if action_name == 'edit' %>
  <%= link_to 'delete', question, :method => :delete, :confirm => 'You sure?', :title => question.name %>
<% end %>