Upgrading ERb tags for Rails 3 upgrade. Should I: <%= end %> as well?

倾然丶 夕夏残阳落幕 提交于 2019-12-25 03:24:51

问题


Given a block of rails 2.3.x ERb code:

<% form_for account, :url => { :action => :invite } do |f| %>
  # blah
<% end %>

using the Rails upgrade plugin, it tells me that I need to replace <% with <%= should I also do this for the end line? Such as:

<%= form_for account, :url => { :action => :invite } do |f| %>
   # blah
<%= end %>

回答1:


No, you would only need <%= when you start a block.

So it would be:

<%= form_for account, :url => { :action => :invite } do |f| %>
   # blah
<% end %>

See this rails/asciicast for upgrading to the new erb.



来源:https://stackoverflow.com/questions/5454644/upgrading-erb-tags-for-rails-3-upgrade-should-i-end-as-well

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!