Search code examples
ruby-on-railsrubyframeworkscontrollers

Rails: Single page website, How to organise controllers/views etc


I have a single page website using ruby on rails as the framework. On the single page I have a

header

section 1

section 2

section 3 etc

footer

The problem I am having is this, how do I organise the layouts/views/controllers. Only in one section I have a form which needs processing and is linked to a database table (model). Can anyone advise me on how I can organise my ROR application?


Solution

  • Well, if you don't create a new layout, everything is going to be in the application layout (app/views/layous/application.html.erb), in this file you're going to create you html for the header and the foother. Also in this file you'll see a <%= yield %>, this yield is going to show you view of your controller.

    Sorry about my english, I hope this help you. Also you could check the Rails Tutorial

    is very helpful and very descriptive. Also you could check the RailsCast videos.

    For the section 1 and section 2 you could check the rails guide to undertand how to show something in any numbers of yields. Here is the link Understanding yield