Hi,
now that I’ve done a few Rails tutorials and understand the basics of
AR,
migrations, templates and such, I would like to embark on my first own
project. It’s a rewrite, so most of the functionality has been done
already
(by me). But there is something that I missed in all the tutorials I’ve
read: structure design.
Assume you have a web app that has users who can sign up, login and
logout,
and users can seach for, and CRUD, some sort of items which get saved in
your database. Plus you have a WelcomeController that does the main
page,
the “about us” links, partner sites and so on.
The question is: how do I integrate all this? For example, I need some
actions that are available globally. For every page request I need to
find
out whether the user is logged in and display his account info in the
sidebar. I guess I need a :before_filter to do this, but how does this
work
exactly?
I would also like to offer a search form on the main page without having
to
resort to linking to “Search:” first.
I have a class “User” and a user_controller. Does logging in and out
belong
into this controller or does it make sense to create another
model/controller (Login) for this?
The user has_many addresses and has_many cars (for example). What’s the
best
way of presenting this info to the user in a way that he can most easily
edit all his info? Are there usability studies somewhere that weigh
different presentation structures?
For what should I create partials, which page elements should commonly
be
cached, should I use link_to for all (even static) links? How do I
include completely static data (does Rails realize whether a static file
with the given path exists? Does that maybe depend on the webserver
used,
and the .htaccess files?)
I have a feeling I’m missing the “big picture” here … I think I got a
rough idea how parts of Rails work but I don’t know how to make them
work
together to fit my project.
Any pointers to documentation would be great.
Thanks!
Jens