Why has this erb behavior changed in Rails 3?

I am porting a Rails 2.8 application to Rails 3. Most of the things now work, and I slowly give up on kinks. The one behavior I found is perplexing, and I would like to understand what has changed behind the scenes. The following code snippet works in 2.x, but crashes 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 the following:

 <% if @apps.nil? || @apps.empty? %> No rated applications. <% else %> <% ratingshidden = false @apps.each { |app| %> display app stuff etc.... 

What has changed in rails to require this updated syntax?

+6
ruby-on-rails
source share
2 answers

I would love to demand a reward and redo it, but I think the article you are looking for is http://timeless.judofyr.net/block-helpers-in-rails3

+7
source share

This railscast explains the changes to erb blocks in Rails 3 and why they were made.

0
source share

All Articles