end
%() declares a string literal, so nothing happens to your
javascript_tag. And
.each won’t return your string - even the correct one.
Try this eRB:
<%= @events.map do |e|
javascript_tag “new
Popup(‘event_popup_#{e.id}’,‘event_link_#{e.id}’);”
end
%>
That still has its own style issues, including it will push several
tags in, not just one efficient one. You could also try this:
<%= javascript_tag @events.map{|e|
"new
Popup('event_popup_#{e.id}','event_link_#{e.id}');"
}.join
%>
So that puts the tag on the outside, and the "unrolled loop" on
the inside.
--
Phlip
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.