I''m a Ruby Nuby, so please bear with me.... I''ve been working through the OnLAMP tutorial, and it seems to work fine, at least for a while. At some (apparently random) point, however, the scaffold-provided links seem to stop working. That is, the New Recipe link from http://127.0.0.1:3000/Recipe/ does nothing, and the edit or destroy links take me to a Not Found page with the message "`/Recipe/1'' not found" (or similar, depending on the specific link). Likewise, http://127.0.0.1:3000/Recipe/new brings up the expected form, but clicking the Create button won''t add anything to my database and just refreshes the form. What''s confounding me is that it will sometimes work correctly, but it will sometimes revert to the above behavior without my having changed anything (at least that I''m aware of). I''m running XP Pro using MySQL and WEBbrick per the tutorial, and I''ve tried deleting the cookbook directory and starting over from scratch several times. That has worked twice (for a little while, at least), and failed twice. Has anyone seen this behavior before? Is there some fix for it? Thanks, Ryan Wells P.S. If I''m doing something monumentally stupid and obvious, feel free to respond privately to spare me the public humiliation. ;-)
eric-O2zf8en5V9XYtjvyW6yDsg@public.gmane.org
2005-Jan-24 01:36 UTC
Re: OnLAMP Tutorial Question
On Sun, Jan 23, 2005 at 06:37:33PM -0600, Ryan Wells wrote:> I''m a Ruby Nuby, so please bear with me.... > > I''ve been working through the OnLAMP tutorial, and it seems to work > fine, at least for a while. At some (apparently random) point, > however, the scaffold-provided links seem to stop working. > > That is, the New Recipe link from http://127.0.0.1:3000/Recipe/ does > nothing, and the edit or destroy links take me to a Not Found page > with the message "`/Recipe/1'' not found" (or similar, depending on > the specific link). > > Likewise, http://127.0.0.1:3000/Recipe/new brings up the expected > form, but clicking the Create button won''t add anything to my database > and just refreshes the form. > > What''s confounding me is that it will sometimes work correctly, but it > will sometimes revert to the above behavior without my having changed > anything (at least that I''m aware of). > > I''m running XP Pro using MySQL and WEBbrick per the tutorial, and I''ve > tried deleting the cookbook directory and starting over from scratch > several times. That has worked twice (for a little while, at least), > and failed twice. > > Has anyone seen this behavior before? Is there some fix for it? > > Thanks, > Ryan Wells > > P.S. If I''m doing something monumentally stupid and obvious, feel free > to respond privately to spare me the public humiliation. ;-) > _______________________________________________Ryan: I''m new to Ruby and Rails too. Are you running on Linux or on Windows? I''m running Linux (SuSE 9.1 pro) and I found that I had to kill the server and then restart it to be able to see my changes. There was no mention of that in the article. Hope that helps in some way. I finally got it working and I''m impressed enough to start learning more about both Ruby and Rails. Eric -- ------------------------------------------------------------------------ # Eric Lucas =======================================================================The uncreative mind can spot the wrong answers, but it takes a very creative mind to spot the wrong questions. -- Anthony Jay
Ryan Wells wrote:> > I''m a Ruby Nuby, so please bear with me.... > > I''ve been working through the OnLAMP tutorial, and it seems to work > fine, at least for a while. At some (apparently random) point, > however, the scaffold-provided links seem to stop working. > > That is, the New Recipe link from http://127.0.0.1:3000/Recipe/ does > nothing, and the edit or destroy links take me to a Not Found page > with the message "`/Recipe/1'' not found" (or similar, depending on > the specific link). > > Likewise, http://127.0.0.1:3000/Recipe/new brings up the expected > form, but clicking the Create button won''t add anything to my database > and just refreshes the form. > > What''s confounding me is that it will sometimes work correctly, but it > will sometimes revert to the above behavior without my having changed > anything (at least that I''m aware of). > > I''m running XP Pro using MySQL and WEBbrick per the tutorial, and I''ve > tried deleting the cookbook directory and starting over from scratch > several times. That has worked twice (for a little while, at least), > and failed twice. > > Has anyone seen this behavior before? Is there some fix for it?That sounds pretty strange... I really don''t know what could be causing that. I would suggest trying to isolate the problem (when it occurs) by doing something like this: 1) First try closing all instances of your browser and then restart the browser to check out your page. Perhaps its got something to do with browser caching. 2) If that doesn''t work, try restarting the WEBrick server, and see if it then starts to work. If either of these work for you (or don''t work for you), please report it back here as these steps my clue us in on where to look for the source of your problem. Curt
Thanks for your help. I can tell what''s wrong, and I''ve got a pretty good idea what I did to cause it, although I don''t understand the reason. I recreated the cookbook project from scratch, and it worked fine. I made it a point to look very carefully at the URLs involved, and the URL associated with Destroy was http://127.0.0.1:3000/Recipe/destroy/1 (where 1 is apparently the recipe id). I then shut down WEBrick, changed to another rails project directory, and restarted it from there using ''ruby script\server'' as usual. That project exhibited the same behavior I described earlier. I then shut down WEBrick again, cd''d to the cookbook directory, started it from there, and the cookbook project (which had previously worked correctly), had stopped working. I checked the URLs, and they appear to be broken. For instance, the link for Destroy now points to http://127.0.0.1:3000/Recipe//1. Typing http://127.0.0.1:3000/Recipe/destroy/1 directly into the browser address bar takes me to an error page telling me that record couldn''t be found, but it does actually remove it from the db. As far as I can tell, at this point restarting WEBrick, closing browsers, and even rebooting won''t fix the problem. It hadn''t occurred to me that switching between projects would have that effect. So what''s going on that I''m misunderstanding? Thanks again, Ryan On Sun, 23 Jan 2005 21:42:33 -0600, Curt Hibbs <curt-fk6st7iWb8MAvxtiuMwx3w@public.gmane.org> wrote:> Ryan Wells wrote: > > > > I''m a Ruby Nuby, so please bear with me.... > > > > I''ve been working through the OnLAMP tutorial, and it seems to work > > fine, at least for a while. At some (apparently random) point, > > however, the scaffold-provided links seem to stop working. > > > > That is, the New Recipe link from http://127.0.0.1:3000/Recipe/ does > > nothing, and the edit or destroy links take me to a Not Found page > > with the message "`/Recipe/1'' not found" (or similar, depending on > > the specific link). > > > > Likewise, http://127.0.0.1:3000/Recipe/new brings up the expected > > form, but clicking the Create button won''t add anything to my database > > and just refreshes the form. > > > > What''s confounding me is that it will sometimes work correctly, but it > > will sometimes revert to the above behavior without my having changed > > anything (at least that I''m aware of). > > > > I''m running XP Pro using MySQL and WEBbrick per the tutorial, and I''ve > > tried deleting the cookbook directory and starting over from scratch > > several times. That has worked twice (for a little while, at least), > > and failed twice. > > > > Has anyone seen this behavior before? Is there some fix for it? > > That sounds pretty strange... I really don''t know what could be causing > that. I would suggest trying to isolate the problem (when it occurs) by > doing something like this: > > 1) First try closing all instances of your browser and then restart the > browser to check out your page. Perhaps its got something to do with browser > caching. > > 2) If that doesn''t work, try restarting the WEBrick server, and see if it > then starts to work. > > If either of these work for you (or don''t work for you), please report it > back here as these steps my clue us in on where to look for the source of > your problem. > > Curt > >
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ryan Wells wrote:> I recreated the cookbook project from scratch, and it worked fine. I > made it a point to look very carefully at the URLs involved, and the > URL associated with Destroy was http://127.0.0.1:3000/Recipe/destroy/1 > (where 1 is apparently the recipe id).Use all-lowercase in your URLs: http://127.0.0.1:3000/recipe/ Rails does a case-insensitive match on the URL to determine the controller and action, but does a case-sensitive match to generate new URLs (redirect_to, link_to, url_for, etc.) This gotcha (bug?) snags a lot of folks. jeremy -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFB9JRcAQHALep9HFYRAn6HAJ9iIiJLdbw9xGMmQcu/jZefTog/SACgyc5X VL4cNhw4EIqj7ePTTi5a9MM=tIQo -----END PGP SIGNATURE-----
Ah, yes, that''s it. I didn''t realize that the real variable was following the links in the article (all lowercase) vs. typing them in myself. I knew it had to be something boneheaded. :-) Thanks to Jeremy and Curt! On Sun, 23 Jan 2005 22:23:24 -0800, Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Ryan Wells wrote: > > I recreated the cookbook project from scratch, and it worked fine. I > > made it a point to look very carefully at the URLs involved, and the > > URL associated with Destroy was http://127.0.0.1:3000/Recipe/destroy/1 > > (where 1 is apparently the recipe id). > > Use all-lowercase in your URLs: http://127.0.0.1:3000/recipe/ > > Rails does a case-insensitive match on the URL to determine the > controller and action, but does a case-sensitive match to generate new > URLs (redirect_to, link_to, url_for, etc.) This gotcha (bug?) snags a > lot of folks. > > jeremy > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.2.6 (Darwin) > Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org > > iD8DBQFB9JRcAQHALep9HFYRAn6HAJ9iIiJLdbw9xGMmQcu/jZefTog/SACgyc5X > VL4cNhw4EIqj7ePTTi5a9MM> =tIQo > -----END PGP SIGNATURE----- >
If this question is as stupid as I think it is please feel free to tell me to RTM. How do you alter the recipe/new page to include being able to choose a category? If you only alter it through the edit function crashes happen. Sorry for the dumbness of this question David
Gonzo wrote:> > If this question is as stupid as I think it is please feel free to tell me > to RTM. > How do you alter the recipe/new page to include being able to choose a > category? > If you only alter it through the edit function crashes happen.Its not a dumb question, I can see that this is a flaw in the tutorial (I never added a new recipe after adding categories -- duh!). You need to create you own "new" action in the controller and create a "new" view template, overriding the one provided by the scaffolding. Just use what you did to add categories in the edit function as a guide. I will correct this in Part 2 of the tutorial (which I am currently working on). Curt
Curt, Thanks for the tutorial. After much hair pulling after installing rails 0.9.5 using the gem install rails command. I finally discovered that installing: gem install rails -v 0.9.4 didn''t work either, since 0.9.5 was still installed. I did a: gem uninstall rails and told it to uninstall both version. For safe measure, I also uninstalled actionrecord, et. al. and reinstalled fresh with the command: gem install rails -v 0.9.4 Finally I''m at the ''Unknown action'' point of the tutorial! Thanks! Regards, JJ On 26-Jan-2005, at 13:32, Curt Hibbs wrote:> Gonzo wrote: >> >> If this question is as stupid as I think it is please feel free to >> tell me >> to RTM. >> How do you alter the recipe/new page to include being able to choose a >> category? >> If you only alter it through the edit function crashes happen. > > Its not a dumb question, I can see that this is a flaw in the tutorial > (I > never added a new recipe after adding categories -- duh!). > > You need to create you own "new" action in the controller and create a > "new" > view template, overriding the one provided by the scaffolding. Just > use what > you did to add categories in the edit function as a guide. > > I will correct this in Part 2 of the tutorial (which I am currently > working > on). > > Curt > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
John Johnson wrote:> > Curt, > > Thanks for the tutorial. > After much hair pulling after installing rails 0.9.5 using the > gem install rails > command. I finally discovered that installing: > gem install rails -v 0.9.4 > didn''t work either, since 0.9.5 was still installed. > I did a: > gem uninstall rails > and told it to uninstall both version. For safe measure, > I also uninstalled actionrecord, et. al. and reinstalled > fresh with the command: > gem install rails -v 0.9.4 > Finally I''m at the ''Unknown action'' point of the tutorial!Thanks for your patience. The ONLamp editor just updated the tutorial to specify version 0.9.4 in the rails installation. So, hopefully, others won''t have to go through what you did. Curt