I’m fairly new to rails but I’ve read a book, many tutorials and watched
video lectures so I’m starting to get a hang of how it works.
I’ve now decided to jump in and create a rails app from scratch. I’m a
little confused when it comes to going from concept to implementation
using MVC. I understand when to use models, pretty much whenever I have
an object that I want to store in a database or resource.
What I’m not sure about is when to create a controller. For basic tasks
like creating/editing users, sessions or objects it makes sense. But
what about other pages in my website that are not necessarily dealing
with CRUD on objects?
For example if I have a website with multiple pages like “contact us” or
“help” which don’t deal with dynamic content but rather display just a
static page of information. Is it common practice to create a
controller for every page in my website (and use its ‘show’ method),
even if they’re static and “hard coded”?
I would like to use a single application.html.erb layout for the entire
website, so adding simple pages like “contact us” are confusing to me
because I don’t know if I should just create an html file somewhere or
have rails generate a view via a “dummy” controller so that it can use
Another question I have is regarding to the index.html page in the
public folder. Is there a way to utilize the application.html.erb
layout for this page as well? If not, how can I create a “home” page
that sort of fits in with the rest of the application.
Thanks for any help.