KeithNYC-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jan-13 23:39 UTC
Page layouts / general site layout with RoR
Hi, I''m pretty new to the whole RoR thing (coming from a .NET background) and have gone through some tutorials both in books and online. In the tutorials the controllers / views make sense. But suppose I have a layout, images, CSS, etc my designer has given me. The index or home page has some general info, and might have some dynamic info coming from the database. The question I have is - do I create a controller just for this page? It''s not a page that is simply listing records, or a data entry screen for a table (as you see in tutorials). It''s a page with dynamic data coming from possibly multiple pages. So what''s the recommendation here? Thanks in advance! -Keith --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
If you do want dynamic data on the page, then yup, you need to create a controller. Many of us create a content_controller.rb for static pages. You can then specify routes that pretty up the URLs to the actions for this controller -- e.g., map.connect '''', :controller => ''content'', :action => ''index'' would make the / path load the index action of the controller (assuming public/index.html has been removed). If the page is completely static, you can place the content in public/ index.html instead. The downside to this approach is that you have to duplicate the application layout in the file itself -- it won''t be able to use any layouts in app/views/layouts. -- Building an e-commerce site with Rails? http://www.agilewebdevelopment.com/rails-ecommerce On Jan 13, 2007, at 3:39 PM, KeithNYC-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> > Hi, > > I''m pretty new to the whole RoR thing (coming from a .NET background) > and have gone through some tutorials both in books and online. > > In the tutorials the controllers / views make sense. But suppose I > have > a layout, images, CSS, etc my designer has given me. The index or home > page has some general info, and might have some dynamic info coming > from the database. > > The question I have is - do I create a controller just for this page? > It''s not a page that is simply listing records, or a data entry screen > for a table (as you see in tutorials). It''s a page with dynamic data > coming from possibly multiple pages. > > So what''s the recommendation here? > > Thanks in advance! > -Keith >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
KeithNYC-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jan-14 15:28 UTC
Re: Page layouts / general site layout with RoR
Thanks for pointing me in the right direction Benjamin. For anyone else that might have this newbie question, I googled ''routes'' and happened across this page that explains it a little further: http://www.paulsturgess.co.uk/articles/show/27 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---