i’m doing some meta stuff and trying to figure out how to stick some
erb html into a proc where i can then feed it to one of many helpers.
if i do something like this:
lamb = lambda do |x|
<%= x %>
end
i get a syntax error because obviously the block isn’t actual code… i
want to be able to do something like <%= html_helper(“something”,
&lamb) %>
any ideas?
thanks!
Stuart
On May 5, 7:02 pm, stewbawka [email protected] wrote:
i’m doing some meta stuff and trying to figure out how to stick some
erb html into a proc where i can then feed it to one of many helpers.
if i do something like this:
lamb = lambda do |x|
<%= x %>
end
because you’re in a ruby file, not an erb file you don’t need to be
this complicated:
lamb = lambda do |x|
" #{ x } "
end
It’s a bit more fiddly if you want to call helpers - (one technique is
to have a magic helper object which includes the various rails helpers
so that you can then do magic_helper.number_to_currency … and things
like that)
Fred
nevermind… i’m an idiot… it works you just have to end the %>
before the erb block… duh