I am coming from the world of PHP and am learning Ruby/Rails. I have a website I did in PHP and would like to convert it to Ruby/Rails. From the 3 books I read on rails they all build an example site where each page has the same layout so they use the file ‘application.html.erb’ for all the pages’ layouts. But my site has two different layouts, some pages contain 3 columns while the rest use 2 columns. I was wondering if someone would suggest how I should go about this in terms of setting up two different layouts in Rails?
Here are examples of what the two different layouts look like:
Create two layouts in
app/views/layouts. Use one of the many methods to specify which layout should be rendered (that entire guide is worth reading). There’s also a Railscast on layouts (though keep in mind it’s rather old).