(these are just a lot of suggestions... take it with a grain of salt)

Right... so for some reason jQuery isn't included properly (I know that from 
"Error: $ is not defined")... although I'm not sure how you are even able to 
get that far given the other error you said you had.

It's interesting that javascript_include_tag (line 7) is throwing the exception 
"word is not defined"

Looks like that problem is in the ExecJS Gem -- is that default in Rails 3.1? 
Did you add that? Remove that Gem from your Gemfile, rebuild the gems (bundle 
install) and see if the problem goes away.

I guess that Gem is part of Rail's default package now? (That is, automatically 
included in the Gemfile when you make a new app)

Not actually sure what your problem is but it looks like that Gem is aliasing 
the javascript_include_tag which is making it not too happy. 

Maybe try examining the line of code in execjs that it is hiccuping on (You 
should be able to find that from your stacktrace)? Perhaps that will have clues 
as to why it is hiccuping when trying to execute javascript_include_tag



On Dec 5, 2011, at 5:18 PM, Craig White wrote:

> 
> 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.
> 
> 

-- 
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