Shane_Davies-dZvVCkJGgBjzqAWY+WmngNBPR1lH4CV8@public.gmane.org
2005-Jul-25 14:39 UTC
Error in Ruby on rails
Hi All, I am new to ruby, rails and the whole shooting match. My introduction was through the article by Curt Hibbs, ''Rolling with Ruby on Rails'' on the ONLAMP.com site. http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html I have followed this article to the letter but I keep getting the same error. I even did it on a different op. sys ( Win2K as opposed to XP) and still got the same error. I would be very grateful if soemone could tell me what is wrong. I have even downloaded the source and database and used them, I still get the same error! I am very keen on getting to grips with this as it seems ideal for a project I have in mind. Regards Shane ============================================================================================================The error is : ActiveRecord::RecordNotFound in Recipe#update . Couldn''t find Recipe without an ID Request Parameters: {"recipe"=>{"title"=>"Ice Water", "id"=>"2", "category_id"=>"2", "description"=>"Everyone''s favorite.", "instructions"=>" Put ice cubes in a glass of water.\r\n \r\n "}} Response Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} The session dump gives: flash: !ruby/hash:ActionController::Flash::FlashHash {} and the framework trace gives : c:/program files/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base .rb:352:in `find'' c:/program files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/sca ffolding.rb:136:in `update'' c:/program files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/bas e.rb:756:in `send'' c:/program files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/bas e.rb:756:in `perform_action_without_filters'' c:/program files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/fil ters.rb:295:in `perform_action_without_benchmark'' c:/program files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/ben chmarking.rb:41:in `perform_action_without_rescue'' c:/program files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/ben chmarking.rb:41:in `measure'' c:/program files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/ben chmarking.rb:41:in `perform_action_without_rescue'' c:/program files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/res cue.rb:80:in `perform_action'' c:/program files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/bas e.rb:356:in `send'' c:/program files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/bas e.rb:356:in `process'' c:/program files/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb:32:in `dispatch'' c:/program files/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:105:in `handle_dispatch'' c:/program files/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:71:in `service'' c:/program files/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' c:/program files/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' c:/program files/ruby/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'' c:/program files/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start'' c:/program files/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'' c:/program files/ruby/lib/ruby/1.8/webrick/server.rb:94:in `start'' c:/program files/ruby/lib/ruby/1.8/webrick/server.rb:89:in `each'' c:/program files/ruby/lib/ruby/1.8/webrick/server.rb:89:in `start'' c:/program files/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' c:/program files/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' c:/program files/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:57:in `dispatch'' _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On Jul 25, 2005, at 8:39 AM, Shane_Davies-dZvVCkJGgBjzqAWY+WmngNBPR1lH4CV8@public.gmane.org wrote:> Hi All, > I am new to ruby, rails and the whole shooting match. My > introduction was through the article by Curt Hibbs, ''Rolling with > Ruby on Rails'' on the ONLAMP.com site. http://www.onlamp.com/pub/a/ > onlamp/2005/01/20/rails.html > > I have followed this article to the letter but I keep getting the > same error. I even did it on a different op. sys ( Win2K as opposed > to XP) and still got the same error. I would be very grateful if > soemone could tell me what is wrong. I have even downloaded the > source and database and used them, I still get the same error! > >What does your controller code look like? (i.e. the ''update'' method in your controller, or whatever is calling Recipe.update). Also, what version of Rails are you using?> I am very keen on getting to grips with this as it seems ideal for > a project I have in mind. > > Regards > > ShaneIt''ll be worth it! Good luck. Duane Johnson (canadaduane) _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
you got a call like Receipt.find(params[:id]) in your code buy params[:id] is empty. you need to pass an ID to the update action On 7/25/05, Shane_Davies-OO0OHOuVXW9A8lJmID/66dBPR1lH4CV8@public.gmane.org <Shane_Davies-OO0OHOuVXW9A8lJmID/66dBPR1lH4CV8@public.gmane.org> wrote:> > > Hi All, > I am new to ruby, rails and the whole shooting match. My introduction was > through the article by Curt Hibbs, ''Rolling with Ruby on Rails'' on the > ONLAMP.com site. > http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html > > I have followed this article to the letter but I keep getting the same > error. I even did it on a different op. sys ( Win2K as opposed to XP) and > still got the same error. I would be very grateful if soemone could tell me > what is wrong. I have even downloaded the source and database and used them, > I still get the same error! > > I am very keen on getting to grips with this as it seems ideal for a project > I have in mind. > > Regards > > Shane > > =============================================================================================================> The error is : > > ActiveRecord::RecordNotFound in Recipe#update > > . Couldn''t find Recipe without an ID > > Request > Parameters: {"recipe"=>{"title"=>"Ice Water", "id"=>"2", "category_id"=>"2", > "description"=>"Everyone''s favorite.", "instructions"=>" Put ice cubes in a > glass of water.\r\n \r\n "}} > > Response > Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} > > > > The session dump gives: > > flash: !ruby/hash:ActionController::Flash::FlashHash {} > > > and the framework trace gives : > > c:/program > files/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:352:in > `find'' > c:/program > files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/scaffolding.rb:136:in > `update'' > c:/program > files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:in > `send'' > c:/program > files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:in > `perform_action_without_filters'' > > c:/program > files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:295:in > `perform_action_without_benchmark'' > > c:/program > files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in > `perform_action_without_rescue'' > > c:/program > files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in > `measure'' > c:/program > files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in > `perform_action_without_rescue'' > > c:/program > files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/rescue.rb:80:in > `perform_action'' > c:/program > files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in > `send'' > c:/program > files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in > `process'' > c:/program > files/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb:32:in > `dispatch'' > c:/program > files/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:105:in > `handle_dispatch'' > c:/program > files/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:71:in > `service'' > c:/program > files/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in > `service'' > c:/program > files/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' > c:/program files/ruby/lib/ruby/1.8/webrick/server.rb:155:in > `start_thread'' > c:/program files/ruby/lib/ruby/1.8/webrick/server.rb:144:in > `start'' > c:/program files/ruby/lib/ruby/1.8/webrick/server.rb:144:in > `start_thread'' > c:/program files/ruby/lib/ruby/1.8/webrick/server.rb:94:in > `start'' > c:/program files/ruby/lib/ruby/1.8/webrick/server.rb:89:in > `each'' > c:/program files/ruby/lib/ruby/1.8/webrick/server.rb:89:in > `start'' > c:/program files/ruby/lib/ruby/1.8/webrick/server.rb:79:in > `start'' > c:/program files/ruby/lib/ruby/1.8/webrick/server.rb:79:in > `start'' > c:/program > files/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:57:in > `dispatch'' > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- Tobi http://www.snowdevil.ca - Snowboards that don''t suck http://typo.leetsoft.com - Open source weblog engine http://blog.leetsoft.com - Technical weblog