Erubis on rails


#1

Hey,

Just thought I’d see how easy it was to use erubis rather than erb in
rails, and so far all seems to be pretty easy. Just added a few lines in
environment.rb and everything works as before.

However, one page is causing a problem. It is a partial that is being
passed a local variable. erubis doesn’t seem to see the local, and gives
the following error?

undefined local variable or method `page’ for
#Erubis::Helper::RailsTemplate:0x27557fc

Even though the partial is being rendered from another page with the
following statement:

<%= render :partial => ‘node’, :locals => { :page => @home_page } %>

Any ideas how you can pass a local to a partial when using erubis?

Thanks,

Mark


#2

There’s already a patch put in for it.
http://rubyforge.org/tracker/index.php?func=detail&aid=6726&group_id=1320&atid=5203
But it doesn’t look like anyone official has looked at it or anything. I
applied the patch and voila! It works! Hope you get the same result.

RSL

Mark D. wrote:

Hey,

Just thought I’d see how easy it was to use erubis rather than erb in
rails, and so far all seems to be pretty easy. Just added a few lines in
environment.rb and everything works as before.

However, one page is causing a problem. It is a partial that is being
passed a local variable. erubis doesn’t seem to see the local, and gives
the following error?

undefined local variable or method `page’ for
#Erubis::Helper::RailsTemplate:0x27557fc

Even though the partial is being rendered from another page with the
following statement:

<%= render :partial => ‘node’, :locals => { :page => @home_page } %>

Any ideas how you can pass a local to a partial when using erubis?

Thanks,

Mark


#3

I just ran across the same error without even calling the local from the
partial itself. It seems like just creating the local raises the error.

Oh fun! A bug to fix for Christmas! Yay!

RSL