On Dec 5, 2011, at 3:04 PM, Jason Fleetwood-Boldt wrote:

> 
> On Dec 5, 2011, at 4:55 PM, Craig White wrote:
> 
>> $('tr:nth-child(odd)').addClass('odd');
> 
> 
> What happens when you just run  $('tr:nth-child(odd)').addClass('odd'); on 
> the web console? Does it correctly select the elements you are looking for ?
----
commenting out the relevant lines in people.js.coffee and then opening up the 
console in FF and executing returns...

Error: $ is not defined
Source File: javascript:%20$('tr:nth-child(odd)').addClass('odd');
Line: 1
----
> 
> 
>> and I get the error - 
>> word is not defined
>> (in /home/users/cwhite/tti_framework/app/assets/javascripts/people.js.coffee)
> 
> 
> 
> "word is not defined" is a little vague, do you think that's happening in 
> jQuery, coffeescript, or your code? (these are rhetorical questions to point 
> you in the right direction).  Also, is that a Rails exception (I'd assume 
> not) or a Javascript error you see in the console (or an error during 
> coffeescript's compile?)
----
ExecJS::ProgramError in People#index

Showing /home/users/cwhite/tti_framework/app/views/layouts/fluid.html.erb where 
line #7 raised:

word is not defined
  (in /home/users/cwhite/tti_framework/app/assets/javascripts/people.js.coffee)

Extracted source (around line #7):

4:     <title>TtiFramework</title>
5:     <meta http-equiv="content-type" content="text/html;charset=utf-8">
6:     <%= stylesheet_link_tag    "application" %>
7:     <%= javascript_include_tag "application" %>
8:     <!--[if IE 6]><link rel="stylesheet" type="text/css" 
href="../../../css/ie6.css" media="screen" /><![endif]-->
9:     <!--[if IE 7]><link rel="stylesheet" type="text/css" 
href="../../../css/ie.css" media="screen" /><![endif]-->
10:     <%= csrf_meta_tags %>

Rails.root: /home/users/cwhite/tti_framework
Application Trace | Framework Trace | Full Trace

app/views/layouts/fluid.html.erb:7:in 
`_app_views_layouts_fluid_html_erb___36715814_94758920'
app/controllers/people_controller.rb:16:in `index'

I am omitting the stack trace purposely
----
> 
> 
>> but still the same problem and my css does indeed have tr.odd defined and 
>> works fine if I do odd_even in the view code which I removed for the benefit 
>> of this test.
> 
> 
> 
> So... it's a little hard to follow you're debugging steps, are you saying 
> that the code you are executing is actually working to add the class to the 
> selected elements?
> 
> If that's the case, remove your code altogether and see if the problems is 
> still happening. If it is, you have a different problem unrelated to the 
> $('tr:nth-child(odd)') selector
----
No - I wasn't saying that.

This was my view code (which works) prior to my attempts to use jquery's 
alternating table row scheme...
    <%
      odd_or_even = 0
      for person in @people
      odd_or_even = 1 - odd_or_even
    %>
      <tr valign="top" class="<%= 'odd' if odd_or_even == 1 %>">
        <tr>
        <td><%= link_to person.uid, :action => 'show', :id => person.id %></td>
      ... <% end %>

and this is what it looks like when trying to use jquery's alternating table 
scheme...
    <% for person in @people %>
      <tr>
        <tr>
        <td><%= link_to person.uid, :action => 'show', :id => person.id %></td>
      ... <% end %>

Craig

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to