I''m just getting started with Rails, and as a simple task I wanted to rehost my website from bare html/apache to Rails. What''s a typical name for the controller for the main page of the website? Rails wants to pluralize it be default... Normally I''d name it after the table in the database it relates to, but for our web site, with no database behind it, that just doesn''t seem correct. Thanks, Per -- 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 Sep 30, 2011, at 1:22 PM, xscribe-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> I''m just getting started with Rails, and as a simple task I wanted to > rehost my website from bare html/apache to Rails. > > What''s a typical name for the controller for the main page of the > website? Rails wants to pluralize it be default... Normally I''d name > it after > the table in the database it relates to, but for our web site, with no > database behind it, that just doesn''t seem correct. > > Thanks,Ryan Bates has a Railscast about this, showing you how to go from static file service to files plus database for these sorts of "static" pages. http://railscasts.com/episodes/117-semi-static-pages What I have done in the past is to create a PagesController (empty), and then place my static pages in the views/pages folder. They Just Work™ from there. If you fiddle the routing, you can remove the /pages/ segment from the URL, too. Walter -- 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.
Nice tip - thanks. I notice that Ryan uses this in his routes file: map.with_options :controller => ''info'' do |info| info.about ''about'', :action => ''about'' info.contact ''contact'', :action => ''contact'' info.privacy ''privacy'', :action => ''privacy'' end Is that still valid in a 3.0/3.1 Rails environment? -p On Sep 30, 10:28 am, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> On Sep 30, 2011, at 1:22 PM, xscr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > > I''m just getting started with Rails, and as a simple task I wanted to > > rehost my website from bare html/apache to Rails. > > > What''s a typical name for the controller for the main page of the > > website? Rails wants to pluralize it be default... Normally I''d name > > it after > > the table in the database it relates to, but for our web site, with no > > database behind it, that just doesn''t seem correct. > > > Thanks, > > Ryan Bates has a Railscast about this, showing you how to go from static file service to files plus database for these sorts of "static" pages. > > http://railscasts.com/episodes/117-semi-static-pages > > What I have done in the past is to create a PagesController (empty), and then place my static pages in the views/pages folder. They Just Work™ from there. If you fiddle the routing, you can remove the /pages/ segment from the URL, too. > > Walter-- 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.
Should be, I just did something following that recipe for my wife''s site. It''s a combo static/dynamic Rails 3.0.10 site. Walter On Sep 30, 2011, at 1:51 PM, xscribe-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> Nice tip - thanks. I notice that Ryan uses this in his routes file: > > map.with_options :controller => ''info'' do |info| > info.about ''about'', :action => ''about'' > info.contact ''contact'', :action => ''contact'' > info.privacy ''privacy'', :action => ''privacy'' > end > > Is that still valid in a 3.0/3.1 Rails environment? > > -p > > > On Sep 30, 10:28 am, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote: >> On Sep 30, 2011, at 1:22 PM, xscr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: >> >>> I''m just getting started with Rails, and as a simple task I wanted to >>> rehost my website from bare html/apache to Rails. >> >>> What''s a typical name for the controller for the main page of the >>> website? Rails wants to pluralize it be default... Normally I''d name >>> it after >>> the table in the database it relates to, but for our web site, with no >>> database behind it, that just doesn''t seem correct. >> >>> Thanks, >> >> Ryan Bates has a Railscast about this, showing you how to go from static file service to files plus database for these sorts of "static" pages. >> >> http://railscasts.com/episodes/117-semi-static-pages >> >> What I have done in the past is to create a PagesController (empty), and then place my static pages in the views/pages folder. They Just Work™ from there. If you fiddle the routing, you can remove the /pages/ segment from the URL, too. >> >> Walter > > -- > 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. >-- 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.
Technically I think it should still work but it''s even easier in 3 match ''about'', :to => ''info#about'', :as => :about match ''contact'', :to => ''info#contact'', :as => :contact match ''privacy'', :to => ''info#privacy'', :as => :privacy -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/0pqGhve7ZHoJ. 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.