I''m working on the onlamp tutorial, and I''m to the point where I have the following controller: class RecipeController < ApplicationController scaffold :recipe end I can enter a new recipe, list recipes, show recipes, but if I click edit from the list view, I get the error "Couldn''t find Recipe without an ID". Same response for edit and destroy. However, the ID is shown in the table. Since I''ve only entered a single line of code (scaffold :recipe), and the other pages seem to work, I''m uncertain what the deal is or how to fix this. Google has nothing. Any pointers? Platform: WEBrick 1.3.1 ruby 1.8.2 (2004-12-25) [i386-mswin32] actionmailer (0.6.1) actionpack (1.4.0) activerecord (1.6.0) rails (0.9.5) rake (0.4.15)
Found the problem. My id field was uppercase. The embarassing thing is that the tutorial specifically states that it needs to be lower case, and I missed it because I was in a rush. Oops...
On Mon, 2005-02-14 at 09:43 -0700, Aaron Cantrell wrote:> Found the problem. My id field was uppercase. The embarassing thing is > that the tutorial specifically states that it needs to be lower case, > and I missed it because I was in a rush. Oops... >It''s good practice to keep your db fields lowercase anyways. :-) -Robby -- /*************************************** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | robby-/Lcn8Y7Ot69QmPsQ1CNsNQ@public.gmane.org * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting & Development * --- Now hosting Ruby on Rails Apps --- ****************************************/
Aaron Cantrell wrote:> > Found the problem. My id field was uppercase. The embarassing thing is > that the tutorial specifically states that it needs to be lower case, > and I missed it because I was in a rush. Oops...I''m glad you figured it out. I even more glad that I didn''t get a chance to respond until now! :-) Just proves the old adage that if you procrastinate long enough the task might just go away. Curt
hi curt- just going through the tutorial i found that the rake tests fail UNLESS i do ruby scripts/new_model Todos ruby scripts/new_controller todos that is, of course, using the plural table def. provided in the tutorial. the docs suggest that this plural/singlular mapping should be accounted for : is this correct? iff not is this bug known? [ahoward@localhost ~]$ rpa list actionmailer 0.3.0-2 Framework for easy email delivery and testing. actionpack 0.9.0-1 A control-flow and template package for the VC part of MVC. activerecord 1.1.0-1 Object-relation mapping put on rails. rails 0.8.0-1 Web-application and persistance framework. railties 0.8.0-2 Create Rails web-applications easily. rake 0.4.15-1 A simple ruby build program with capabilities similar to make rpa-base 0.2.3-1 A port/package manager for the Ruby Production Archive (RPA) text-format 0.64-1 Library to perform text formatting capabilities under Ruby. [ahoward@localhost ~]$ ruby -v ruby 1.8.2 (2005-02-12) [i686-linux] note my versions (those provided by rpa) are NOT bleeding edge. kind regards. -a -- ==============================================================================| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | When you do something, you should burn yourself completely, like a good | bonfire, leaving no trace of yourself. --Shunryu Suzuki ===============================================================================
Ara.T.Howard wrote:> just going through the tutorial i found that the rake tests fail UNLESS > i do > [...] > note my versions (those provided by rpa) are NOT bleeding edge.Give it a shot with a non-ancient Rails install. As far as I know, the RPA guys stopped packaging Rails. They should drop it from the repository rather than abandon releases with an old version. I assume there''s some issue with gems; here''s a tarball: http://rubyforge.org/frs/download.php/2767/rails-0.9.5.tgz jeremy
On Mon, 14 Feb 2005, Jeremy Kemper wrote:> Give it a shot with a non-ancient Rails install.thanks for the heads up.> As far as I know, the RPA guys stopped packaging Rails. They should drop it > from the repository rather than abandon releases with an old version.agreed.> I assume there''s some issue with gems; here''s a tarball:just that i like to install into system space ;-)> http://rubyforge.org/frs/download.php/2767/rails-0.9.5.tgzi''ll get back after trying with latest. kind regards. -a -- ==============================================================================| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | When you do something, you should burn yourself completely, like a good | bonfire, leaving no trace of yourself. --Shunryu Suzuki ===============================================================================
Aren''t you getting my recipe tutorial confused with the todo list tutorial? Curt Ara.T.Howard wrote:> > hi curt- > > just going through the tutorial i found that the rake tests fail > UNLESS i do > > ruby scripts/new_model Todos > ruby scripts/new_controller todos > > that is, of course, using the plural table def. provided in the > tutorial. the > docs suggest that this plural/singlular mapping should be > accounted for : is > this correct? iff not is this bug known? > > [ahoward@localhost ~]$ rpa list > actionmailer 0.3.0-2 Framework for easy email delivery > and testing. > actionpack 0.9.0-1 A control-flow and template package > for the VC part of MVC. > activerecord 1.1.0-1 Object-relation mapping put on rails. > rails 0.8.0-1 Web-application and persistance framework. > railties 0.8.0-2 Create Rails web-applications easily. > rake 0.4.15-1 A simple ruby build program with > capabilities similar to make > rpa-base 0.2.3-1 A port/package manager for the Ruby > Production Archive (RPA) > text-format 0.64-1 Library to perform text formatting > capabilities under Ruby. > > [ahoward@localhost ~]$ ruby -v > ruby 1.8.2 (2005-02-12) [i686-linux] > > note my versions (those provided by rpa) are NOT bleeding edge. > > kind regards. > > -a > -- > =================================================================> ============> | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov > | PHONE :: 303.497.6469 > | When you do something, you should burn yourself completely, like a good > | bonfire, leaving no trace of yourself. --Shunryu Suzuki > =================================================================> ============> -- > No virus found in this incoming message. > Checked by AVG Anti-Virus. > Version: 7.0.300 / Virus Database: 265.8.7 - Release Date: 2/10/2005 >
On Mon, 14 Feb 2005, Curt Hibbs wrote:> Aren''t you getting my recipe tutorial confused with the todo list tutorial?yes curt. new mail client. sorry for noise. -a> > Curt > > Ara.T.Howard wrote: >> >> hi curt- >> >> just going through the tutorial i found that the rake tests fail >> UNLESS i do >> >> ruby scripts/new_model Todos >> ruby scripts/new_controller todos >> >> that is, of course, using the plural table def. provided in the >> tutorial. the >> docs suggest that this plural/singlular mapping should be >> accounted for : is >> this correct? iff not is this bug known? >> >> [ahoward@localhost ~]$ rpa list >> actionmailer 0.3.0-2 Framework for easy email delivery >> and testing. >> actionpack 0.9.0-1 A control-flow and template package >> for the VC part of MVC. >> activerecord 1.1.0-1 Object-relation mapping put on rails. >> rails 0.8.0-1 Web-application and persistance framework. >> railties 0.8.0-2 Create Rails web-applications easily. >> rake 0.4.15-1 A simple ruby build program with >> capabilities similar to make >> rpa-base 0.2.3-1 A port/package manager for the Ruby >> Production Archive (RPA) >> text-format 0.64-1 Library to perform text formatting >> capabilities under Ruby. >> >> [ahoward@localhost ~]$ ruby -v >> ruby 1.8.2 (2005-02-12) [i686-linux] >> >> note my versions (those provided by rpa) are NOT bleeding edge. >> >> kind regards. >> >> -a >> -- >> =================================================================>> ============>> | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov >> | PHONE :: 303.497.6469 >> | When you do something, you should burn yourself completely, like a good >> | bonfire, leaving no trace of yourself. --Shunryu Suzuki >> =================================================================>> ============>> -- >> No virus found in this incoming message. >> Checked by AVG Anti-Virus. >> Version: 7.0.300 / Virus Database: 265.8.7 - Release Date: 2/10/2005 >> > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-a -- ==============================================================================| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | When you do something, you should burn yourself completely, like a good | bonfire, leaving no trace of yourself. --Shunryu Suzuki ===============================================================================
On Mon, 14 Feb 2005, Curt Hibbs wrote:> Aren''t you getting my recipe tutorial confused with the todo list tutorial?i was, but it still doesn''t seem to work quite right: [ahoward@localhost ~]$ uname -srm Linux 2.6.10-1.760_FC3 i686 [ahoward@localhost ~]$ ruby -v ruby 1.8.2 (2005-02-12) [i686-linux] [ahoward@localhost ~]$ gem list *** LOCAL GEMS *** actionmailer (0.6.1) Service layer for easy email delivery and testing. actionpack (1.4.0) Web-flow and rendering framework putting the VC in MVC. activerecord (1.6.0) Implements the ActiveRecord pattern for ORM. rails (0.9.5) Web-application framework with template engine, control-flow layer, and ORM. rake (0.4.15) Ruby based make-like utility. sources (0.0.1) This package provides download sources for remote gem installation [ahoward@localhost ~]$ rails cookbook && cd cookbook (in /usr/local/lib/ruby/gems/1.8/gems/rails-0.9.5) rm -rf /home/ahoward/cookbook ... ... ... cp environments/shared_for_gem.rb /home/ahoward/cookbook/config/environment.rb chmod 755 /home/ahoward/cookbook/script/breakpointer [ahoward@localhost cookbook]$ ruby script/server > server.log 2>&1 & [1] 15476 [ahoward@localhost cookbook]$ lynx -dump http://127.0.0.1:3000 | tail Then try the friendly Rails community [3]on the web or [4]on IRC ([5]FreeNode#rubyonrails). References 1. http://www.fastcgi.com/ 2. http://raa.ruby-lang.org/list.rhtml?name=fcgi 3. http://www.rubyonrails.org/ 4. http://www.rubyonrails.org/show/IRC 5. irc://irc.freenode.net/#rubyonrails [ahoward@localhost cookbook]$ ruby script/generate controller MyTest [ahoward@localhost cookbook]$ cat app/controllers/my_test_controller.rb class MyTestController < ApplicationController end now, it seems like there is something weird with the url rewriting going on no? lynx succeeds: [ahoward@localhost cookbook]$ date && lynx -dump http://127.0.0.1:3000/My_Test > /dev/null 2>&1 Tue Feb 15 09:11:56 MST 2005 [ahoward@localhost cookbook]$ echo $? 0 [ahoward@localhost cookbook]$ tail -2 server.log 127.0.0.1 - - [15/Feb/2005:09:11:56 MST] "GET /My_Test HTTP/1.0" 500 617 - -> /My_Test curl succeeds: [ahoward@localhost cookbook]$ date && curl http://127.0.0.1:3000/My_Test > /dev/null 2>&1 Tue Feb 15 09:12:11 MST 2005 [ahoward@localhost cookbook]$ echo $? 0 [ahoward@localhost cookbook]$ tail -2 server.log 127.0.0.1 - - [15/Feb/2005:09:12:11 MST] "GET /My_Test HTTP/1.1" 500 617 - -> /My_Test wget fails: [ahoward@localhost cookbook]$ date && wget http://127.0.0.1:3000/My_Test > /dev/null 2>&1 Tue Feb 15 09:12:22 MST 2005 [ahoward@localhost cookbook]$ echo $? 1 [ahoward@localhost cookbook]$ tail -2 server.log 127.0.0.1 - - [15/Feb/2005:09:12:22 MST] "GET /My_Test HTTP/1.0" 500 617 - -> /My_Test links succeeds: [ahoward@localhost cookbook]$ date && links -dump http://127.0.0.1:3000/My_Test > /dev/null 2>&1 Tue Feb 15 09:13:27 MST 2005 [ahoward@localhost cookbook]$ echo $? 0 [ahoward@localhost cookbook]$ tail -2 server.log 127.0.0.1 - - [15/Feb/2005:09:13:27 MST] "GET /My_Test HTTP/1.1" 500 617 - -> /My_Test firefox fails: (screen capture on request - it''s error 500 too) i realize this could be a bug in wget, but in wget AND firefox? even if those clients are doing something weird it seems they should be worked around... so that''s problem one. problem two is that, continuing on with the tutorial, creation of the recipe model/controller doesn''t seem to result in correct redirection either: [ahoward@localhost cookbook]$ cat app/models/recipe.rb class Recipe < ActiveRecord::Base end [ahoward@localhost cookbook]$ cat app/controllers/recipe_controller.rb class RecipeController < ApplicationController scaffold :recipe end [ahoward@localhost cookbook]$ lynx -dump http://127.0.0.1:3000/recipe/new > /dev/null 2>&1 [ahoward@localhost cookbook]$ echo $? 0 so lynx works, but firefox yields `/recipe/new'' not found. o.k. - so some sort of caching is going on. if i exit firefox and try again it works. can anyone shed light on why url re-writing should be stateful? it seems like it should not be? in summary the redirection scheme seems not *quite* right - am i the only one noticing this general behaviour? kind regards. -a -- ==============================================================================| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | When you do something, you should burn yourself completely, like a good | bonfire, leaving no trace of yourself. --Shunryu Suzuki ===============================================================================