If I created a route like this map.about ''/about'', :controller => ''pages'', :action => ''about And then added this to a different page <%= link_to "About", about_url %> And decided to change my route to map.resources :about the link to no longer works. What am I doing wrong? -- 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.
And how about your Page Controller, did you change it to About Controller? In your first implementation you''ve used Pages Controller to create your About page. If you didn''t change it to and About Controller you can to do something loke that: map.resources :pages, :member => { :about => :get } []''s 2010/1/3 Rong <ron.green-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> If I created a route like this > map.about ''/about'', *:controller => ''pages''*, :action => ''about > > And then added this to a different page > <%= link_to "About", about_url %> > > And decided to change my route to > * map.resources :about* > > the link to no longer works. > > What am I doing wrong? > > -- > > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > >-- Thais Camilo ... nem todo mundo é igual, as experiências da vida definem atitudes -- 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.
An "about us" page is not a candidate for a rest resource. You had it fine before. If you turned your pages controller into a rest resource and moved the "about" page into the resulting cms, then you might create a helper method "about_url" that generates the newly correct url. If you wanted users to be able to create many "abouts", edit and destroy them, then you would create an "abouts_controller". The index action would give a list of abouts (abouts_url would link to it). If you want to view an individual "about" then about_url(@about). To edit it, edit_about_url(about). To update it, the form_for(@about) will take care of the put method. Likewise, link_to "delete about", about_url(about), :method => :delete will remove it. To create a new one, new_about_url will get you there. On Jan 2, 10:17 pm, Rong <ron.gr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If I created a route like this > map.about ''/about'', :controller => ''pages'', :action => ''about > > And then added this to a different page > <%= link_to "About", about_url %> > > And decided to change my route to > map.resources :about > > the link to no longer works. > > What am I doing wrong?-- 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.
The correct answer is: map.resources :pages, :collection => {:home => :get, :about => :get, :contact => :get } and then the link_to becomes: <%= link_to ''About'', about_pages_path%> On Jan 2, 9:41 pm, Thais Camilo <nar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> And how about your Page Controller, did you change it to About Controller? > > In your first implementation you''ve used Pages Controller to create your > About page. If you didn''t change it to and About Controller you can to do > something loke that: > > map.resources :pages, :member => { :about => :get } > > []''s > > 2010/1/3 Rong <ron.gr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > > > > > If I created a route like this > > map.about ''/about'', *:controller => ''pages''*, :action => ''about > > > And then added this to a different page > > <%= link_to "About", about_url %> > > > And decided to change my route to > > * map.resources :about* > > > the link to no longer works. > > > What am I doing wrong? > > > -- > > > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscrib e@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- > Thais Camilo > ... nem todo mundo é igual, as experiências da vida definem atitudes-- 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.
Ron Green wrote:> The correct answer is: > > map.resources :pages, :collection => {:home => :get, :about > => :get, :contact => :get } > > and then the link_to becomes: > > <%= link_to ''About'', about_pages_path%>This is a bit of a perversion of map.resources. You probably want to just consider this :controller/:action (which the default routes already provide). [Please don''t top-post.] Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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.
This is not a real app. so stuff your perversion and top posting. I got this from RailsCasts http://railscasts.com/episodes/35-custom-rest-actions On Jan 3, 1:07 pm, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Ron Green wrote: > > The correct answer is: > > > map.resources :pages, :collection => {:home => :get, :about > > => :get, :contact => :get } > > > and then the link_to becomes: > > > <%= link_to ''About'', about_pages_path%> > > This is a bit of a perversion of map.resources. You probably want to > just consider this :controller/:action (which the default routes already > provide). > > [Please don''t top-post.] > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > -- > 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.
Ron Green wrote:> This is not a real app. so stuff your perversion and top posting.Be polite if you want help. And if it''s not a real app, then why waste your time on it? Presumably to learn good practice, right?> I got this from RailsCasts > http://railscasts.com/episodes/35-custom-rest-actionsYes, it will work. My point was that it''s conceptually wrong for what you''re doing -- you don''t want to make every static page a custom REST action. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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.
I understand. My apologies for my rudeness. On Jan 4, 7:25 pm, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Ron Green wrote: > > This is not a real app. so stuff your perversion and top posting. > > Be polite if you want help. And if it''s not a real app, then why waste > your time on it? Presumably to learn good practice, right? > > > I got this from RailsCasts > >http://railscasts.com/episodes/35-custom-rest-actions > > Yes, it will work. My point was that it''s conceptually wrong for what > you''re doing -- you don''t want to make every static page a custom REST > action. > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > -- > 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.