Hello everyone, I''ve just recently started learning Rails and have searched this forum to try and find an answer with no luck to this seemingly simple issue. I''m hoping someone out there might be able to help me get on the right track - so far it''s been days just getting through the installation process on Mac 10.4 to the point where everything appears to work on the surface. First of all, what I''m attempting to do is to go through the book Agile Web Development with Rails 2nd ed., from the beginning, to refresh everything. I''m up to page 36 and already I''ve hit a roadblock. Here''s my steps: 1. ran "rails -d mysql test3app" to generate a new app. 2. ran "script/server" in the new directory. 3. ran "ruby script/generate controller Say" as instructed on page 36 of the Agile book. 4. Confirmed localhost:3000 was running in the browser and everything looks good. Got this output about my app: Ruby version 1.8.6 (i686-darwin8.11.1) RubyGems version 1.0.1 Rails version 2.0.2 Active Record version 2.0.2 Action Pack version 2.0.2 Active Resource version 2.0.2 Action Mailer version 2.0.2 Active Support version 2.0.2 Application root /usr/local/src/test3app Environment development Database adapter sqlite3 Database schema version 0 5. Edited say_controller.rb to read the following: class SayController < ApplicationController def hello end end 6. Pointed browser at http://localhost:3000/say/hello and got the following: Routing Error No route matches "/say/hello" with {:method=>:get} Was expecting: Template is missing Missing template script/../config/../app/views/say/hello.rhtml (or .html.erb) Any ideas? These steps appear to work fine if I use Locomotive. However, I wanted to install everything from source so I''d have the latest version and benefit from all the great new stuff. I just can''t figure out why this should be a problem in Rails 2 and fine in Locomotive''s Rails v.1.2.x. So perhaps I did something wrong during the installation process, I have some ridiculous typo that I''m missing, or else there is some new way of writing a controller in Rails 2 that I''m not aware of. I''ve looked all day for an answer so here''s to hoping someone can help me out here! And happy new year everyone! Cheers, Joe -- Joe Lewis http://www.sanbeiji.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 -~----------~----~----~----~------~----~------~--~---
On Mon, 2007-12-31 at 17:18 -0800, Joe Lewis wrote:> Hello everyone, > > I''ve just recently started learning Rails and have searched this forum > to try and find an answer with no luck to this seemingly simple issue. > I''m hoping someone out there might be able to help me get on the right > track - so far it''s been days just getting through the installation > process on Mac 10.4 to the point where everything appears to work on > the surface. > > First of all, what I''m attempting to do is to go through the book > Agile Web Development with Rails 2nd ed., from the beginning, to > refresh everything. I''m up to page 36 and already I''ve hit a > roadblock. Here''s my steps: > > 1. ran "rails -d mysql test3app" to generate a new app. > 2. ran "script/server" in the new directory. > 3. ran "ruby script/generate controller Say" as instructed on page 36 > of the Agile book. > 4. Confirmed localhost:3000 was running in the browser and everything > looks good. Got this > output about my app: > > Ruby version 1.8.6 (i686-darwin8.11.1) > RubyGems version 1.0.1 > Rails version 2.0.2 > Active Record version 2.0.2 > Action Pack version 2.0.2 > Active Resource version 2.0.2 > Action Mailer version 2.0.2 > Active Support version 2.0.2 > Application root /usr/local/src/test3app > Environment development > Database adapter sqlite3 > Database schema version 0 > > 5. Edited say_controller.rb to read the following: > > class SayController < ApplicationController > def hello > end > end > > 6. Pointed browser at http://localhost:3000/say/hello and got the > following: > > Routing Error > No route matches "/say/hello" with {:method=>:get} > > Was expecting: > > Template is missing > Missing template script/../config/../app/views/say/hello.rhtml > (or .html.erb) > > Any ideas? > > These steps appear to work fine if I use Locomotive. However, I wanted > to install everything from source so I''d have the latest version and > benefit from all the great new stuff. I just can''t figure out why this > should be a problem in Rails 2 and fine in Locomotive''s Rails v.1.2.x. > So perhaps I did something wrong during the installation process, I > have some ridiculous typo that I''m missing, or else there is some new > way of writing a controller in Rails 2 that I''m not aware of. I''ve > looked all day for an answer so here''s to hoping someone can help me > out here!---- I never bought AWDWR 2 but it''s clear that you''re missing some step somewhere because you generated the controller but not the view template which of course is the error that you are seeing. Did the book tell you to create a file app/views/say/hello.rhtml ? and put some stuff into that file like ''Say Hello'' ? 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-/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 Dec 31, 5:30 pm, Craig White <craigwh...-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote:> I never bought AWDWR 2 but it''s clear that you''re missing some step > somewhere because you generated the controller but not the view template > which of course is the error that you are seeing. Did the book tell you > to create a file app/views/say/hello.rhtml ? and put some stuff into > that file like ''Say Hello'' ?Yes, that was the next step in the book and I did try that - created hello.rhtml inside app/views/say/. Tried hello.html.erb too. Neither one made any difference and I''m still stuck on the routing error. I was *hoping* I would see the template error without the view template but can''t even get that far. -Joe --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Joe, try restarting you server. Good luck, -Conrad On Dec 31, 2007 6:57 PM, Joe Lewis <joelewis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > On Dec 31, 5:30pm, Craig White <craigwh...-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote: > > > I never bought AWDWR 2 but it''s clear that you''re missing some step > > somewhere because you generated the controller but not the view template > > which of course is the error that you are seeing. Did the book tell you > > to create a file app/views/say/hello.rhtml ? and put some stuff into > > that file like ''Say Hello'' ? > > Yes, that was the next step in the book and I did try that - created > hello.rhtml inside app/views/say/. Tried hello.html.erb too. Neither > one made any difference and I''m still stuck on the routing error. I > was *hoping* I would see the template error without the view template > but can''t even get that far. > > -Joe > > >--~--~---------~--~----~------------~-------~--~----~ 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 Dec 31, 7:39 pm, "Conrad Taylor" <conra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Joe, try restarting you server. > Good luck, > > -ConradWell that did the trick. Thank you very much Conrad! Such a simple thing. So I''m now curious why the restart was required - but no big matter. It works now and I can add items to my controller now with no problems. And now I know a little more about this framework. Now I can enjoy my new year''s eve... ;-) A toast to everyone! Cheers, Joe --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Mon, 31 Dec 2007 17:18:11 -0800, Joe Lewis wrote:> I''ve just recently started learning Rails and have searched this forum > to try and find an answer with no luck to this seemingly simple issue.If I may take you on a tangent: subversion, http://svnbook.red- bean.com/ , you only need the first few bits. I have found it quite helpful to learn enough subversion to use http://code.google.com/ for a project. Subversion pros: ---------------- 1.) You can roll back to yesterdays code and start over quite easily 2.) You can work from several different computers, or deploy to another 3.) You won''t lose word (code) Subversion con: --------------- 1.) One more thing to learn -Thufir --~--~---------~--~----~------------~-------~--~----~ 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''m going through the same book myself except I''m running things on Windows Vista. I had exactly the same problem and had to restart the Mongrel web 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 -~----------~----~----~----~------~----~------~--~---
Joe Lewis wrote:> On Dec 31, 7:39�pm, "Conrad Taylor" <conra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> Hi Joe, try restarting you server. >> Good luck, >> >> -Conrad > > Well that did the trick. Thank you very much Conrad! Such a simple > thing. So I''m now curious why the restart was required - but no big > matter. It works now and I can add items to my controller now with no > problems. And now I know a little more about this framework. > > Now I can enjoy my new year''s eve... ;-) A toast to everyone! > > Cheers, > JoeIf using Rails 3.0 then before restarting server with "rails server" edit "config/routes.rb", and uncomment the following line: match '':controller(/:action(/:id(.:format)))'' then restart server -- 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-/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.
> If using Rails 3.0 then before restarting server with "rails server" > edit "config/routes.rb", and uncomment the following line: > > match '':controller(/:action(/:id(.:format)))'' > > then restart serverTHIS WAS AMAZING. THANK YOU SO MUCH. Why does no one say anything about this anywhere else?! Thanks neels! -- 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-/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.
To answer a previous question, that being, "why do you have to restart the server after editing the routes", the reason is because the file config/routes.rb is read when the server loads, and its information stored in memory. The application doesn''t want to re-load the routes file for every request because it just adds overhead, making it take more time (we''re talking fractions of a second, but that adds up significantly over several thousand users) to process a request. As far as your point of taking advantage of all the cool new stuff, just to let you know, Rails v. 2.x is basically outdated now. Rails 3.0 was released just a few weeks ago (prior version was 2.3.9) and has a LOT of new stuff - relationships are different (see "Arel" or "ActiveRelation" - same thing), the database agnosticism has different ways for doing queries (see "ActiveRecord" version 3), routing is very different (config/routes.rb as above), and so on. Given that you''re just starting out, you can install the 2.x series of Rails as you have above and get along fine - it''ll make a lot more sense as you''re moving along with the book. But just remember that the latest and greatest is already a full version release ahead of the book. This is one major reason I usually don''t bother buying books on anything related to Ruby - the community moves way too fast for a book to be relevant, and usually breaks - quite unabashedly - backwards compatibility in doing so. This isn''t so much a criticism as an observation, by the way. Also, to the points about Subversion above - all the points apply to most modern source control systems and aren''t unique to Subversion. SVN is pretty awesome and I''ve been a fan of it for years (so this is in no way meant as a "slam" to the original author for mentioning it, only an elaboration on it), but the "cool kids club" these days seems to prefer a tool called "git". The Ruby community seems to be very "populist"/teen-girl in its behavior on what tools are considered "best of breed" at any given moment. I swear to God it reminds me of junior high - when brand X was popular but you were considered a leper if you used brand Y. Rewind to 2006 or so and Subversion was all the rage. Today it''s git. Three years from now, who knows. I don''t buy the whole "git > svn > perforce > cvs" etc. arguments as a whole unto themselves - you just need to understand that there are different tools that work better or worse than another in a given situation (that being, your workflow), and there are other constraints to consider in the reality of a multi-user, usually corporate or somewhat- mature start-up like environment, where you can''t go dicking with server configs and all the "new shiny" stuff three times a day - you eventually have to actually get work done, too. Just thought I''d elaborate on those points to give you some more information on the general direction of things :) Linkage incoming: Git: http://git-scm.org/ Subversion: http://subversion.apache.org/ Rails Guides - an excellent supplement to the book: http://guides.rubyonrails.org/ Good luck man! On Oct 12, 11:17 pm, "Wyatt R." <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> > If using Rails 3.0 then before restarting server with "rails server" > > edit "config/routes.rb", and uncomment the following line: > > > match '':controller(/:action(/:id(.:format)))'' > > > then restart server > > THIS WAS AMAZING. THANK YOU SO MUCH. > > Why does no one say anything about this anywhere else?! Thanks neels! > > -- > 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-/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.
Wyatt R. wrote in post #949730:>> If using Rails 3.0 then before restarting server with "rails server" >> edit "config/routes.rb", and uncomment the following line: >> >> match '':controller(/:action(/:id(.:format)))'' >> >> then restart server > > THIS WAS AMAZING. THANK YOU SO MUCH. > > Why does no one say anything about this anywhere else?! Thanks neels!Many thanks -- 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-/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.