w455up
08-04-2010, 12:31 AM
Hi, I'm relatively new to RoR programming. I'm trying to integrate some of my rails code in a javascript function that is added at the end of an .each loop, and right now I'm getting a "missing } after property list" error only on the last one called. If I remove the RoR stuff and leave it as a simple text string, it works fine for all of them. Here is my code:
("#popup_<%= i %>").SetBubblePopup({
innerHtml: '<ul class="subcats"> <li id="inline"> <%=h link_to h(cat.name), { :controller =>'category', :action => 'show', :id => cat } -%> </li> <% Category.all.select {|s| !s.name.eql?("- none -") and !s.name.eql?("NONE") and s.parent_id.eql?(cat.id) and s.is_live}.each do |sub| %> <li id="inline"> <%=h link_to h(sub.name), { :controller =>'category', :action => 'show', :id => sub } -%> </li> <% end %> </ul> ',
bubbleAlign:'left',
tailAlign:'left',
closingDelay:2
});
I believe something in the big blob of html/RoR code is causing the missing } error, but I can't seem to find it. Here is the code in a formatted form:
<ul class="subcats">
<li id="inline">
<%=h link_to h(cat.name), { :controller =>'category', :action => 'show', :id => cat } -%>
</li>
<% Category.all.select {|s| !s.name.eql?("- none -") and !s.name.eql?("NONE") and s.parent_id.eql?(cat.id) and s.is_live}.each do |sub| %>
<li id="inline">
<%=h link_to h(sub.name), { :controller =>'category', :action => 'show', :id => sub } -%>
</li>
<% end %>
</ul>
Thanks for any help anyone is able to offer.
("#popup_<%= i %>").SetBubblePopup({
innerHtml: '<ul class="subcats"> <li id="inline"> <%=h link_to h(cat.name), { :controller =>'category', :action => 'show', :id => cat } -%> </li> <% Category.all.select {|s| !s.name.eql?("- none -") and !s.name.eql?("NONE") and s.parent_id.eql?(cat.id) and s.is_live}.each do |sub| %> <li id="inline"> <%=h link_to h(sub.name), { :controller =>'category', :action => 'show', :id => sub } -%> </li> <% end %> </ul> ',
bubbleAlign:'left',
tailAlign:'left',
closingDelay:2
});
I believe something in the big blob of html/RoR code is causing the missing } error, but I can't seem to find it. Here is the code in a formatted form:
<ul class="subcats">
<li id="inline">
<%=h link_to h(cat.name), { :controller =>'category', :action => 'show', :id => cat } -%>
</li>
<% Category.all.select {|s| !s.name.eql?("- none -") and !s.name.eql?("NONE") and s.parent_id.eql?(cat.id) and s.is_live}.each do |sub| %>
<li id="inline">
<%=h link_to h(sub.name), { :controller =>'category', :action => 'show', :id => sub } -%>
</li>
<% end %>
</ul>
Thanks for any help anyone is able to offer.