Just starting out with a beginner book on jquery and the very first thing I am trying fails (has to be me) Rails 3.1 - other jquery things working including a poor example of drag & drop that is my ultimate target here but just simply trying to get every alternating row in a table to have a different css class So I''m using... app/assets/javascripts/people.js.coffee and put in... $(document).ready(function() { $(''tr:nth-child(odd)'').addClass(''odd''); }); and I get the error - word is not defined (in /home/users/cwhite/tti_framework/app/assets/javascripts/people.js.coffee) So I tried variations including $(document).ready(function() { $(''tr:odd'').addClass(''odd''); }); 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. -- Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ craig.white-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org 1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com Need help communicating between generations at work to achieve your desired success? Let us help! -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 ?> 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?)> 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 -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Dec 5, 2011, at 5:04 PM, Jason Fleetwood-Boldt wrote:> 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?Grammatical correction: "your debugging steps" -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
You may not have property path to jquery/ .js file. Get Firebug in firefox, to remove the error. On Mon, Dec 5, 2011 at 2:08 PM, Jason Fleetwood-Boldt <tech-eJ8lBn5LdNBhbmWW9KSYcQ@public.gmane.org>wrote:> > On Dec 5, 2011, at 5:04 PM, Jason Fleetwood-Boldt wrote: > > > 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? > > > Grammatical correction: "your debugging steps" > > > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
well I''m reasonably certain that the problem is getting the base jquery.js loaded but: - I am using Rails 3.1 (development mode) - my ''Gemfile'' looks like this (the top part anyway) source ''http://rubygems.org'' gem ''rails'', ''3.1.3'' # Bundle edge Rails instead: # gem ''rails'', :git => ''git://github.com/rails/rails.git'' # Rails standard install gems gem ''pg'' gem ''json'' gem ''execjs'' gem ''therubyracer'' # Gems used only for assets and not required # in production environments by default. group :assets do gem ''sass-rails'', ''~> 3.1.4'' gem ''coffee-rails'', ''~> 3.1.1'' gem ''uglifier'', ''>= 1.0.3'' end gem ''jquery-rails'' and other jquery things are clearly working for me as I''ve gotten rounded corners & drag/drop working (ui plugin items I think) But I definitely don''t understand what you mean by ''you may not have property path to jquery/ .js file. and I do have Firebug installed here. Craig On Dec 5, 2011, at 3:18 PM, jay parteek wrote:> You may not have property path to jquery/ .js file. Get Firebug in firefox, to remove the error. > > > > > On Mon, Dec 5, 2011 at 2:08 PM, Jason Fleetwood-Boldt <tech-eJ8lBn5LdNBhbmWW9KSYcQ@public.gmane.org> wrote: > > On Dec 5, 2011, at 5:04 PM, Jason Fleetwood-Boldt wrote: > > > 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? > > > Grammatical correction: "your debugging steps" > > > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.-- Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ craig.white-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org 1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com Need help communicating between generations at work to achieve your desired success? Let us help! -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
(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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Dec 5, 2011, at 3:34 PM, Jason Fleetwood-Boldt wrote:> > (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.---- Thanks for the potshots... I suspect that wouldn''t matter since the gem would be sucked back in by other requirements... # gem uninstall execjs You have requested to uninstall the gem: execjs-1.2.9 coffee-script-2.2.0 depends on [execjs (>= 0)] sprockets-2.0.3 depends on [execjs (~> 1.0)] uglifier-1.1.0 depends on [execjs (>= 0.3.0)] If you remove this gems, one or more dependencies will not be met. Continue with Uninstall? [Yn] n ERROR: While executing gem ... (Gem::DependencyRemovalException) Uninstallation aborted due to dependent gem(s) ----> > 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 sure - various resources told me that I needed to include it in the Gemfile (execjs) so I did but any bundle exec run would have put it in there if it wasn''t so it seems moot ----> 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---- the stacktrace and the lines in ruby_racer_runtime.rb mean nothing to me except that it feels there is a syntax error. execjs (1.2.9) lib/execjs/ruby_racer_runtime.rb:47:in `call'' execjs (1.2.9) lib/execjs/ruby_racer_runtime.rb:78:in `lock'' therubyracer (0.9.9) lib/v8/c/locker.rb:13:in `Locker'' execjs (1.2.9) lib/execjs/ruby_racer_runtime.rb:76:in `lock'' execjs (1.2.9) lib/execjs/ruby_racer_runtime.rb:40:in `call'' coffee-script (2.2.0) lib/coffee_script.rb:57:in `compile'' tilt (1.3.3) lib/tilt/coffee.rb:46:in `evaluate'' tilt (1.3.3) lib/tilt/template.rb:76:in `render'' sprockets (2.0.3) lib/sprockets/context.rb:175:in `evaluate'' sprockets (2.0.3) lib/sprockets/context.rb:172:in `each'' sprockets (2.0.3) lib/sprockets/context.rb:172:in `evaluate'' sprockets (2.0.3) lib/sprockets/bundled_asset.rb:171:in `build_dependency_context_and_body'' sprockets (2.0.3) lib/sprockets/bundled_asset.rb:135:in `dependency_context'' sprockets (2.0.3) lib/sprockets/bundled_asset.rb:194:in `build_dependencies_paths_and_assets'' sprockets (2.0.3) lib/sprockets/bundled_asset.rb:141:in `dependency_paths'' sprockets (2.0.3) lib/sprockets/bundled_asset.rb:61:in `mtime'' sprockets (2.0.3) lib/sprockets/asset.rb:58:in `send'' sprockets (2.0.3) lib/sprockets/asset.rb:58:in `encode_with'' sprockets (2.0.3) lib/sprockets/asset.rb:57:in `each'' sprockets (2.0.3) lib/sprockets/asset.rb:57:in `encode_with'' sprockets (2.0.3) lib/sprockets/bundled_asset.rb:43:in `encode_with'' sprockets (2.0.3) lib/sprockets/caching.rb:52:in `cache_asset'' sprockets (2.0.3) lib/sprockets/environment.rb:82:in `build_asset'' sprockets (2.0.3) lib/sprockets/base.rb:99:in `find_asset'' sprockets (2.0.3) lib/sprockets/environment.rb:72:in `find_asset'' sprockets (2.0.3) lib/sprockets/base.rb:110:in `[]'' sprockets (2.0.3) lib/sprockets/bundled_asset.rb:200:in `build_dependencies_paths_and_assets'' sprockets (2.0.3) lib/sprockets/bundled_asset.rb:194:in `each'' sprockets (2.0.3) lib/sprockets/bundled_asset.rb:194:in `build_dependencies_paths_and_assets'' sprockets (2.0.3) lib/sprockets/bundled_asset.rb:141:in `dependency_paths'' sprockets (2.0.3) lib/sprockets/bundled_asset.rb:61:in `mtime'' sprockets (2.0.3) lib/sprockets/asset.rb:58:in `send'' sprockets (2.0.3) lib/sprockets/asset.rb:58:in `encode_with'' sprockets (2.0.3) lib/sprockets/asset.rb:57:in `each'' sprockets (2.0.3) lib/sprockets/asset.rb:57:in `encode_with'' sprockets (2.0.3) lib/sprockets/bundled_asset.rb:43:in `encode_with'' sprockets (2.0.3) lib/sprockets/caching.rb:52:in `cache_asset'' sprockets (2.0.3) lib/sprockets/environment.rb:82:in `build_asset'' sprockets (2.0.3) lib/sprockets/trail.rb:102:in `find_asset_in_path'' sprockets (2.0.3) lib/sprockets/base.rb:101:in `find_asset'' sprockets (2.0.3) lib/sprockets/environment.rb:72:in `find_asset'' sprockets (2.0.3) lib/sprockets/base.rb:110:in `[]'' actionpack (3.1.3) lib/sprockets/helpers/rails_helper.rb:130:in `asset_for'' actionpack (3.1.3) lib/sprockets/helpers/rails_helper.rb:27:in `javascript_include_tag'' actionpack (3.1.3) lib/sprockets/helpers/rails_helper.rb:26:in `collect'' actionpack (3.1.3) lib/sprockets/helpers/rails_helper.rb:26:in `javascript_include_tag'' actionpack (3.1.3) lib/action_view/template.rb:171:in `send'' actionpack (3.1.3) lib/action_view/template.rb:171:in `render'' activesupport (3.1.3) lib/active_support/notifications.rb:55:in `instrument'' actionpack (3.1.3) lib/action_view/template.rb:169:in `render'' actionpack (3.1.3) lib/action_view/renderer/template_renderer.rb:52:in `render_with_layout'' actionpack (3.1.3) lib/action_view/renderer/template_renderer.rb:38:in `render_template'' actionpack (3.1.3) lib/action_view/renderer/template_renderer.rb:12:in `render'' actionpack (3.1.3) lib/action_view/renderer/abstract_renderer.rb:22:in `wrap_formats'' actionpack (3.1.3) lib/action_view/renderer/template_renderer.rb:9:in `render'' actionpack (3.1.3) lib/action_view/renderer/renderer.rb:36:in `render_template'' actionpack (3.1.3) lib/action_view/renderer/renderer.rb:17:in `render'' actionpack (3.1.3) lib/abstract_controller/rendering.rb:120:in `_render_template'' actionpack (3.1.3) lib/action_controller/metal/streaming.rb:250:in `_render_template'' actionpack (3.1.3) lib/abstract_controller/rendering.rb:114:in `render_to_body'' actionpack (3.1.3) lib/action_controller/metal/renderers.rb:30:in `render_to_body'' actionpack (3.1.3) lib/action_controller/metal/compatibility.rb:43:in `render_to_body'' actionpack (3.1.3) lib/abstract_controller/rendering.rb:99:in `render'' actionpack (3.1.3) lib/action_controller/metal/rendering.rb:16:in `render'' actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:40:in `render'' activesupport (3.1.3) lib/active_support/core_ext/benchmark.rb:5:in `ms'' /usr/local/lib/ruby/1.8/benchmark.rb:308:in `realtime'' activesupport (3.1.3) lib/active_support/core_ext/benchmark.rb:5:in `ms'' actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:40:in `render'' actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:78:in `cleanup_view_runtime'' activerecord (3.1.3) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'' activeldap (3.1.1) lib/active_ldap/railties/controller_runtime.rb:24:in `cleanup_view_runtime'' actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:39:in `render'' actionpack (3.1.3) lib/action_controller/metal/implicit_render.rb:10:in `default_render'' actionpack (3.1.3) lib/action_controller/metal/mime_responds.rb:268:in `retrieve_response_from_mimes'' actionpack (3.1.3) lib/action_controller/metal/mime_responds.rb:195:in `call'' actionpack (3.1.3) lib/action_controller/metal/mime_responds.rb:195:in `respond_to'' actionpack (3.1.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'' actionpack (3.1.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'' actionpack (3.1.3) lib/abstract_controller/base.rb:167:in `process_action'' actionpack (3.1.3) lib/action_controller/metal/rendering.rb:10:in `process_action'' actionpack (3.1.3) lib/abstract_controller/callbacks.rb:18:in `process_action'' activesupport (3.1.3) lib/active_support/callbacks.rb:425:in `_run__29468547__process_action__199225275__callbacks'' activesupport (3.1.3) lib/active_support/callbacks.rb:386:in `send'' activesupport (3.1.3) lib/active_support/callbacks.rb:386:in `_run_process_action_callbacks'' activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `send'' activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `run_callbacks'' actionpack (3.1.3) lib/abstract_controller/callbacks.rb:17:in `process_action'' actionpack (3.1.3) lib/action_controller/metal/rescue.rb:17:in `process_action'' actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:30:in `process_action'' activesupport (3.1.3) lib/active_support/notifications.rb:53:in `instrument'' activesupport (3.1.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'' activesupport (3.1.3) lib/active_support/notifications.rb:53:in `instrument'' actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:29:in `process_action'' actionpack (3.1.3) lib/action_controller/metal/params_wrapper.rb:201:in `process_action'' activerecord (3.1.3) lib/active_record/railties/controller_runtime.rb:18:in `process_action'' activeldap (3.1.1) lib/active_ldap/railties/controller_runtime.rb:18:in `process_action'' actionpack (3.1.3) lib/abstract_controller/base.rb:121:in `process'' actionpack (3.1.3) lib/abstract_controller/rendering.rb:45:in `process'' actionpack (3.1.3) lib/action_controller/metal.rb:193:in `dispatch'' actionpack (3.1.3) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'' actionpack (3.1.3) lib/action_controller/metal.rb:236:in `action'' actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:65:in `call'' actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:65:in `dispatch'' actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:29:in `call'' rack-mount (0.8.3) lib/rack/mount/route_set.rb:152:in `call'' rack-mount (0.8.3) lib/rack/mount/code_generation.rb:96:in `recognize'' rack-mount (0.8.3) lib/rack/mount/code_generation.rb:75:in `optimized_each'' rack-mount (0.8.3) lib/rack/mount/code_generation.rb:95:in `recognize'' rack-mount (0.8.3) lib/rack/mount/route_set.rb:141:in `call'' actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:532:in `call'' actionpack (3.1.3) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'' rack (1.3.5) lib/rack/etag.rb:23:in `call'' rack (1.3.5) lib/rack/conditionalget.rb:25:in `call'' actionpack (3.1.3) lib/action_dispatch/middleware/head.rb:14:in `call'' actionpack (3.1.3) lib/action_dispatch/middleware/params_parser.rb:21:in `call'' actionpack (3.1.3) lib/action_dispatch/middleware/flash.rb:247:in `call'' rack (1.3.5) lib/rack/session/abstract/id.rb:195:in `context'' rack (1.3.5) lib/rack/session/abstract/id.rb:190:in `call'' actionpack (3.1.3) lib/action_dispatch/middleware/cookies.rb:331:in `call'' activerecord (3.1.3) lib/active_record/query_cache.rb:64:in `call'' activerecord (3.1.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:477:in `call'' actionpack (3.1.3) lib/action_dispatch/middleware/callbacks.rb:29:in `call'' activesupport (3.1.3) lib/active_support/callbacks.rb:392:in `_run_call_callbacks'' activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `send'' activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `run_callbacks'' actionpack (3.1.3) lib/action_dispatch/middleware/callbacks.rb:28:in `call'' actionpack (3.1.3) lib/action_dispatch/middleware/reloader.rb:68:in `call'' rack (1.3.5) lib/rack/sendfile.rb:101:in `call'' actionpack (3.1.3) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'' actionpack (3.1.3) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'' railties (3.1.3) lib/rails/rack/logger.rb:13:in `call'' rack (1.3.5) lib/rack/methodoverride.rb:24:in `call'' rack (1.3.5) lib/rack/runtime.rb:17:in `call'' activesupport (3.1.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'' rack (1.3.5) lib/rack/lock.rb:15:in `call'' actionpack (3.1.3) lib/action_dispatch/middleware/static.rb:53:in `call'' railties (3.1.3) lib/rails/engine.rb:456:in `call'' rack (1.3.5) lib/rack/content_length.rb:14:in `call'' railties (3.1.3) lib/rails/rack/log_tailer.rb:14:in `call'' rack (1.3.5) lib/rack/handler/webrick.rb:59:in `service'' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' /usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'' /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'' /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'' rack (1.3.5) lib/rack/handler/webrick.rb:13:in `run'' rack (1.3.5) lib/rack/server.rb:265:in `start'' railties (3.1.3) lib/rails/commands/server.rb:70:in `start'' railties (3.1.3) lib/rails/commands.rb:54 railties (3.1.3) lib/rails/commands.rb:49:in `tap'' railties (3.1.3) lib/rails/commands.rb:49 script/rails:6:in `require'' script/rails:6> > > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ craig.white-wmL3h9Ogt9Bhl2p70BpVqQ@public.gmane.orgm 1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com Need help communicating between generations at work to achieve your desired success? Let us help! -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Dec 5, 9:55 pm, Craig White <craig.wh...-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org> wrote:> Just starting out with a beginner book on jquery and the very first thing I am trying fails (has to be me) > > Rails 3.1 - other jquery things working including a poor example of drag & drop that is my ultimate target here but just simply trying to get every alternating row in a table to have a different css class > > So I''m using... > > app/assets/javascripts/people.js.coffee and put in... > > $(document).ready(function() { > $(''tr:nth-child(odd)'').addClass(''odd''); > > });A .coffees file should contain coffeescript, whereas you appear to have put javascript in your people.js.coffee Fred> > and I get the error - > word is not defined > (in /home/users/cwhite/tti_framework/app/assets/javascripts/people.js.coffee) > > So I tried variations including > $(document).ready(function() { > $(''tr:odd'').addClass(''odd''); > > }); > > 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. > > -- > Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ craig.wh...@ttiltd.com > 1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~www.ttiassessments.com > > Need help communicating between generations at work to achieve your desired success? Let us help!-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Dec 6, 2011, at 12:29 AM, Frederick Cheung wrote:> > > On Dec 5, 9:55 pm, Craig White <craig.wh...-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org> wrote: >> Just starting out with a beginner book on jquery and the very first thing I am trying fails (has to be me) >> >> Rails 3.1 - other jquery things working including a poor example of drag & drop that is my ultimate target here but just simply trying to get every alternating row in a table to have a different css class >> >> So I''m using... >> >> app/assets/javascripts/people.js.coffee and put in... >> >> $(document).ready(function() { >> $(''tr:nth-child(odd)'').addClass(''odd''); >> >> }); > > A .coffees file should contain coffeescript, whereas you appear to > have put javascript in your people.js.coffee---- ::::blush:::: told you I was just starting out and it had to be me - just had to be in the most basic way imaginable. That was it - thanks as always. 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.