Why has this erb behavior changed in Rails 3?
I'm porting a Rails 2.8 application to Rails 3. Most things are now working, and am slowly ironing out kinks. One behavior that I've found is kind of perplexing,开发者_运维知识库 and I would like to understand what changed behind the scenes. The following code snippet works in 2.x, but fails in 3.0:
<% if @apps.nil? || @apps.empty? %>
No rated applications.
<% else
ratingshidden = false
@apps.each { |app| %>
display app stuff etc....
to make it work in 3, I have to change as following:
<% if @apps.nil? || @apps.empty? %>
No rated applications.
<% else %>
<%
ratingshidden = false
@apps.each { |app| %>
display app stuff etc....
What changed in rails to require this updated syntax?
This railscast explains the changes in erb blocks in Rails 3 and why they were made.
精彩评论