Ruby on Rails optimization - create page controller for general layouts?

What is the standard way to structure semi-static web pages in a Rails application?

I come from the LAMP background, and usually I would have these pages:

about.php
index.php
common/
    header.php
    footer.php
    scripts.php
    (etc)
sign-up.php
scripts/
    jQuery.js
    etc
styles/
    main.css
(etc)

Inside these files php will be used for header, footer, etc.

Should I create a controller called Pages?

+3
source share
3 answers

To answer your question directly: do not create a controller for the general layout ... But follow the tips below:

1 about.php, index.php, sign-up.php.:

aboutand indexactions can be collected in the controller, as a rule, I call it Static.

Thus, logically representations will be in /app/views/static/

sign_up : User. , Registration.

2. common/ header.php, footer.php, scripts.php :

layouts/_header.html.erb, _footer.html.erb, _scripts.html.erb + , .

3. scripts/jQuery.js styles/main.css /public/javascripts /public/stylesheets ( , Rails 3.0.x)

+6

, , Layouts. , /app/views/layouts ( application.html.erb), "" . , , . .

+5

railscast . , !

+3

All Articles