Hello everyone, While walking through AWDWR, Task D: Add a Dash of AJAX, I was initially unable to let the AJAX magic work. Hitting the Add to Cart button doesn''t yield to any output on its own; I had to manually refresh the pages to witness the change. But when I tried to restart the ruby server, and load the application again, everything worked fine. Any explanations to behavior mentioned above? Are there other instances in which you have to restart a ruby server? Thanks! --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 18 May 2008, at 10:25, soa_dias wrote:> > Hello everyone, > > While walking through AWDWR, Task D: Add a Dash of AJAX, I was > initially unable to let the AJAX magic work. Hitting the Add to Cart > button doesn''t yield to any output on its own; I had to manually > refresh the pages to witness the change. But when I tried to restart > the ruby server, and load the application again, everything worked > fine. > > Any explanations to behavior mentioned above? Are there other > instances in which you have to restart a ruby server?Well you definitely need to restart the server if you make changes to environment.rb (and its friends like things in config/initializers and the per-environment files like development.rb), routes.rb and if you install change any plugins. Without knowing exactly what was happening its hard to say in your case. Fred --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Don''t know what exactly happened in that chapter/task D that you mention. But as a general rule you have to restart the server whenever you make changes to the config files or include a new plugin. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for the tips, I''ll keep those in mind. But I apparently did not alter any configuration files while coding the cart application, so its strikes me as odd that I had to restart the server in order to get my application working well. I was unclear before, so let me try to explain my situation more in detail. I was working on section 9.2 of the book. It''s the part wherein you modify the "Add to Cart" button to send an AJAX request instead of a normal HTTP Post request, by adding this code to the index.rhtml view: <% form_remote_tag :url => { :action => :add_to_cart, :id => product } do %> <%= submit_tag "Add to Cart" %> <% end %> Then I followed these steps: --> I enabled javascript libraries through the <%javascript_include_tag :defaults %> --> Then I disabled the browser refresh upon clicking the "Add to Cart" button by stopping the page from redirecting to the index display --> Afterwards, I added app/views/store/add_to_cart.rjs with this code "page.replace_html("cart" , :partial => "cart" , :object => @cart)". --> I saved everything, hit the refresh button on the browser, then when i finally click on the "Add to Cart" button, nothing happens. The cart display on the side bar ought to display the product that I''ve chosen to add. Only after refreshing again do i see the cart updated with the correct information. Of course, everything would eventually work fine if i restart the server. But still, I wish to understand this behavior to further understand the rails framework. Thanks! :) On May 18, 7:06 pm, Thorsten Mueller <rails-mailing-l...@andreas- s.net> wrote:> Don''t know what exactly happened in that chapter/task D that you > mention. > But as a general rule you have to restart the server whenever you make > changes to the config files or include a new plugin. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
And by the way, the development.log did report an error that shows something like this: Processing StoreController#add_to_cart (for 127.0.0.1 at 2008-05-18 22:53:41) [POST] Session ID: 8f38baa3f8b1d03e8cc8716aec52bb3f Parameters: {"commit"=>"Add to Cart", "action"=>"add_to_cart", "id"=>"2", "controller"=>"store"} [4;36;1mProduct Columns (0.016000) [0m [0;1mSHOW FIELDS FROM products [0m [4;35;1mProduct Load (0.015000) [0m [0mSELECT * FROM products WHERE (products.id = 2) [0m Rendering within layouts/store Rendering store/add_to_cart ActionView::TemplateError (No such file or directory - ./script/../ config/../app/views/store/add_to_cart.rhtml) in app/views/store/ add_to_cart.rhtml: I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_view/base.rb:440:in `mtime'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_view/base.rb:440:in `compile_template?'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_view/base.rb:317:in `compile_and_render_template'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_view/base.rb:301:in `render_template'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_view/base.rb:260:in `render_file'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_controller/base.rb:806:in `render_file'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_controller/base.rb:711:in `render_with_no_layout'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_controller/layout.rb:247:in `render_without_benchmark'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_controller/benchmarking.rb:50:in `render'' I:/InstantRails/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_controller/benchmarking.rb:50:in `render'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_controller/base.rb:1096:in `perform_action_without_filters'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_controller/filters.rb:632:in `call_filter'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_controller/filters.rb:619:in `perform_action_without_benchmark'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_controller/benchmarking.rb:66:in `perform_action_without_rescue'' I:/InstantRails/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_controller/benchmarking.rb:66:in `perform_action_without_rescue'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_controller/rescue.rb:83:in `perform_action'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_controller/base.rb:430:in `send'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_controller/base.rb:430:in `process_without_filters'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_controller/filters.rb:624:in `process_without_session_management_support'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_controller/session_management.rb:114:in `process'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/ action_controller/base.rb:330:in `process'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/ dispatcher.rb:41:in `dispatch'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel/rails.rb:78:in `process'' I:/InstantRails/ruby/lib/ruby/1.8/thread.rb:135:in `synchronize'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel/rails.rb:76:in `process'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:618:in `process_client'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:617:in `each'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:617:in `process_client'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:736:in `run'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:736:in `initialize'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:736:in `new'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:736:in `run'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:720:in `initialize'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:720:in `new'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel.rb:720:in `run'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel/configurator.rb:271:in `run'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel/configurator.rb:270:in `each'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel/configurator.rb:270:in `run'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ bin/mongrel_rails:127:in `run'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ lib/mongrel/command.rb:211:in `run'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/ bin/mongrel_rails:243 I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/ lib/active_support/dependencies.rb:488:in `load'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/ lib/active_support/dependencies.rb:488:in `load'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/ lib/active_support/dependencies.rb:342:in `new_constants_in'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/ lib/active_support/dependencies.rb:488:in `load'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/ commands/servers/mongrel.rb:60 I:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:27:in `gem_original_require'' I:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:27:in `require'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/ lib/active_support/dependencies.rb:495:in `require'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/ lib/active_support/dependencies.rb:342:in `new_constants_in'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/ lib/active_support/dependencies.rb:495:in `require'' I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/ commands/server.rb:39 I:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:27:in `gem_original_require'' I:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:27:in `require'' script/server:3 Rendering I:/InstantRails/ruby/lib/ruby/gems/1.8/gems/ actionpack-1.13.2/lib/action_controller/templates/rescues/layout.rhtml (500 Internal Error) --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
That''s very unusual to have to restart your server for it to detect a new view file, especially if there was an action for it. I was going to point out that you weren''t using the Rails 2.0 file extensions too, before I realised you''re not using Rails 2.0. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Actually I''ve run into this issue before also, seems to be limited to js views used for ajax, where rails doesn''t seem to know its there until i restart the server. I have no idea why, and I have no idea under what conditions it happens, just wanted to say I''ve experienced it.. On May 18, 10:07 pm, "Ryan Bigg (Radar)" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> That''s very unusual to have to restart your server for it to detect a new > view file, especially if there was an action for it. I was going to point > out that you weren''t using the Rails 2.0 file extensions too, before I > realised you''re not using Rails 2.0.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I see, my old version of rails is the culprit then. Thanks for that info. I didn''t download the latest version of rails before because I thought that it might have deprecated some of the Rails 1.2 syntax used in the book. I guess I should just give it a try then. :) On May 19, 10:07 am, "Ryan Bigg (Radar)" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> That''s very unusual to have to restart your server for it to detect a new > view file, especially if there was an action for it. I was going to point > out that you weren''t using the Rails 2.0 file extensions too, before I > realised you''re not using Rails 2.0.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
The older version of rails may not be the culprit, I never said it definitely was. I was just musing that you were using an older version of Rails. On Mon, May 19, 2008 at 2:24 PM, soa_dias <soa_dias-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> > I see, my old version of rails is the culprit then. Thanks for that > info. I didn''t download the latest version of rails before because I > thought that it might have deprecated some of the Rails 1.2 syntax > used in the book. I guess I should just give it a try then. :) > > On May 19, 10:07 am, "Ryan Bigg (Radar)" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > That''s very unusual to have to restart your server for it to detect a new > > view file, especially if there was an action for it. I was going to point > > out that you weren''t using the Rails 2.0 file extensions too, before I > > realised you''re not using Rails 2.0. > > >-- Appreciated my help? Reccommend me on Working With Rails http://workingwithrails.com/person/11030-ryan-bigg --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On May 18, 2008, at 3:25 AM, soa_dias wrote:> > Hello everyone, > > While walking through AWDWR, Task D: Add a Dash of AJAX, I was > initially unable to let the AJAX magic work. Hitting the Add to Cart > button doesn''t yield to any output on its own; I had to manually > refresh the pages to witness the change. But when I tried to restart > the ruby server, and load the application again, everything worked > fine.From the Troubleshooting section of that chapter: "Some readers have reported that they have to stop and start their appli- cation to get the AJAX-based cart to work." --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---