I am writing my first RoR app. I have used the following command to create several pages: $ rails generate controller home index (I created home, news, gallery, contact,...) I created the menus in app/views/layouts/application.html.erb : <div id="menu"> <ul> <li><a href="/">Home</a></li> <li><a href="/news">News</a></li> <li><a href="/gallery">Gallery</a></li> <li><a href="/membership">Membership</a></li> <li><a href="/sponsors">Sponsors</a></li> <li><a href="/faq">FAQ''s</a></li> <li><a href="/shoot">Shoot Info</a></li> <li><a href="/contact">Contact</a></li> </ul> If I click on one of the menu button "Gallery", I get: Routing Error No route matches [GET] "/gallery" The config/routes.rb has: get "gallery/index" What am I missing? 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.
Check out the rails routing guide: http://guides.rubyonrails.org/routing.html Look also into the link_to approaches, as you can get very clean, versatile code this way On Dec 5, 7:25 am, David Burton <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I am writing my first RoR app. > I have used the following command to create several pages: > $ rails generate controller home index (I created home, news, gallery, > contact,...) > I created the menus in app/views/layouts/application.html.erb : > <div id="menu"> > <ul> > <li><a href="/">Home</a></li> > <li><a href="/news">News</a></li> > <li><a href="/gallery">Gallery</a></li> > <li><a href="/membership">Membership</a></li> > <li><a href="/sponsors">Sponsors</a></li> > <li><a href="/faq">FAQ''s</a></li> > <li><a href="/shoot">Shoot Info</a></li> > <li><a href="/contact">Contact</a></li> > </ul> > > If I click on one of the menu button "Gallery", I get: > Routing Error > > No route matches [GET] "/gallery" > > The config/routes.rb has: > > get "gallery/index" > > What am I missing? > > Thanks > > -- > 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.
Thanks To get my menus to work, I had to change the routes.rb From: get "contact/index" To: resources :contact I must be using the generate command incorrectly? I used: $ rails generate controller contact index Should I have used some other generate command? -- 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.
On Mon, Dec 5, 2011 at 12:48 PM, David Burton <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Thanks > > To get my menus to work, > I had to change the routes.rb > > From: > get "contact/index" > > To: > > resources :contact > > I must be using the generate command incorrectly? > > I used: $ rails generate controller contact index > > Should I have used some other generate command? > >As a tip (I''m kind of new in rails), I only generate the models and after that I manually create the controllers/views and also modify the routes.rb (that file has good examples about routing ) I started with rails g scaffold, but sometimes it''s not what I need, that''s why I started to create my models first. Is there someone using another way? Javier Q. -- 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.
On 5 December 2011 17:48, David Burton <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Thanks > > To get my menus to work, > I had to change the routes.rb > > From: > get "contact/index" > > To: > > resources :contact > > I must be using the generate command incorrectly? > > I used: $ rails generate controller contact index > > Should I have used some other generate command?I think your original route would have worked if you had used the url contact/index, which is after all what you asked for in the generate command. Colin -- 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.
On Mon, Dec 5, 2011 at 13:31, Javier Quarite <jquarites-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I started with rails g scaffold, but sometimes it''s not what I need, that''s > why I started to create my models first.I usually go ahead and use scaffolding, but then delete what I don''t intend to use. It''s a lot easier than making sure I remember to put all the pieces in. :-) -Dave -- LOOKING FOR WORK! What: Ruby (on/off Rails), Python, other modern languages. Where: Northern Virginia, Washington DC (near Orange Line), and remote work. See: davearonson.com (main) * codosaur.us (code) * dare2xl.com (excellence). Specialization is for insects. (Heinlein) - Have Pun, Will Babble! (Aronson) -- 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.