Go Back   CodingForums.com > :: Server side development > Ruby & Ruby On Rails

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-04-2010, 12:31 AM   PM User | #1
w455up
New to the CF scene

 
Join Date: Aug 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
w455up is an unknown quantity at this point
Weird javascript error

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:

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:

Code:
<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.
w455up is offline   Reply With Quote
Old 08-18-2010, 01:25 PM   PM User | #2
orangegigs
New to the CF scene

 
Join Date: Aug 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
orangegigs is an unknown quantity at this point
i think ur missing the curly braces between the code . thoroughly check ur code and do experiment with the code to see which one works. you can visit my site which is developed with ruby on rails for more information. http://www.orangegigs.com
orangegigs is offline   Reply With Quote
Reply

Bookmarks

Tags
javascript, ror

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:54 AM.


Advertisement
Log in to turn off these ads.