What’s the standard way to structure a Rails app’s semi-static web pages?
I come from a LAMP background and traditionally I’d have pages such as this:
about.php
index.php
common/
header.php
footer.php
scripts.php
(etc)
sign-up.php
scripts/
jQuery.js
etc
styles/
main.css
(etc)
Inside those files, there would be a php include for the header, footer, etc.
Should I generate a controller called Pages?
To answer your question straight: don’t create a Controller for shared layout … But follow the advice below:
1.
about.php, index.php, sign-up.php:aboutandindexactions could be gathered in a controller, generally I name itStatic.So logically, views would be in
/app/views/static/For
sign_upit would depend on your choice: whether or not you want it to stick to yourUsermodel. Generally, it goes to someRegistrationcontroller.2.
common/ header.php, footer.php, scripts.phpwould become:layouts/_header.html.erb, _footer.html.erb, _scripts.html.erb+ you should create a layout including these partials.3.
scripts/jQuery.jsandstyles/main.csswill go to/public/javascriptsand/public/stylesheets(at least for Rails 3.0.x)