Just starting my first project and wondering what is the proper design in terms of number of Controllers for simple static page having just following site layout: home | services | portfolio | about. Should I create one Controller for each? Or create action methods representing above layout in ApplicationController? Thanks, Bogumbiker
Hi, In such case I would create one controller, let''s say site with actions home (or index), services, portfolio and about. If the content is not dynamic, the code in the controller will be empty, the view will contain the static text. I do not see any reason for creating controller for these things. The links to the actions should be placed maybe in the ApplicationController layout if you want to have them on every page of your site. bw, Georg On Aug 17, 2:42 am, bgumbiker <bogumil.bial...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Just starting my first project and wondering what is the proper design > in terms of number of Controllers for simple static page having just > following site layout: home | services | portfolio | about. Should I > create one Controller for each? Or create action methods representing > above layout in ApplicationController? > Thanks, > Bogumbiker
If we''re talking about static pages that doesn''t need to be edited, take a look at High Voltage (http://github.com/thoughtbot/high_voltage/ tree/master). If the pages needs to be edited, go ahead and watch Ryan B''s excellent screencast on semi-static pages: http://railscasts.com/episodes/117-semi-static-pages On Aug 17, 2:42 am, bgumbiker <bogumil.bial...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Just starting my first project and wondering what is the proper design > in terms of number of Controllers for simple static page having just > following site layout: home | services | portfolio | about. Should I > create one Controller for each? Or create action methods representing > above layout in ApplicationController? > Thanks, > Bogumbiker
bgumbiker wrote:> Just starting my first project and wondering what is the proper design > in terms of number of Controllers for simple static page having just > following site layout: home | services | portfolio | about. Should I > create one Controller for each? Or create action methods representing > above layout in ApplicationController?If your site only has static pages (which seems to be the case) then don''t use Rails at all! Consider something like StaticMatic or perhaps a CMS.> Thanks, > BogumbikerBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
Thanks a lot for this clarification. Indeed my site will be semi-static and i am ok to edit from time to time just the view. However the html/css is quite complex and wondering where to put all div and classes blocks + css for each of them. Should I put such code into partials? thanks, bogumil On Aug 17, 4:53 pm, Fifigyuri <fifigy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > In such case I would create one controller, let''s say site with > actions home (or index), services, portfolio and about. If the content > is not dynamic, the code in the controller will be empty, the view > will contain the static text. I do not see any reason for creating > controller for these things. The links to the actions should be placed > maybe in the ApplicationController layout if you want to have them on > every page of your site. > > bw, Georg > > On Aug 17, 2:42 am, bgumbiker <bogumil.bial...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Just starting my first project and wondering what is the proper design > > in terms of number of Controllers for simple static page having just > > following site layout: home | services | portfolio | about. Should I > > create one Controller for each? Or create action methods representing > > above layout in ApplicationController? > > Thanks, > >Bogumbiker