resources

Hi, I'm confused about resources. When should one choose to use the
resource/REST approach to a model?

For example, for the user model, should I choose to make the user a
resource or should I just use the controller only approach with no REST
involved?

What I'm doing first is making a registration page for a user. Should I
start off with
# ruby script/generate resource User

( If I use this approach how do I automatically generate the "7 golden
actions?" )

or

# ruby script/generate model User
# ruby script/generate controller User

?

I've seen tutorials on how to create resources and use REST, but don't
understand when to use the approach.

Any advice or links to references would be greatly appreciated!

If you’re looking to build a simple authentication system, there’s already plenty out there.

I recommend using acts_as_authenticated, but if you’re looking for something restful, give restful_authentication a shot.

You use a model any time you want to keep data around. In the example
you provide, you presumably want to keep information about the user in
your application so you would create a User model and fill it with all
the business logic required to maintain it.

Resources and REST are about how you *access* models. That's the
basic difference. What may be confusing is that generate/scaffold
creates both a RESTful API and a model. It may lead you to believe
that there is a 'resource' and a 'model' or that in some cases they
are synonymous... but they're not. Models~data, resources~data access
via HTTP

The restful_autentication plugin (one of those many authentication
systems that Ryan refers to while missing the general question you're
asking) will demonstrate a good example of models and resources. With
that plugin you create a single model (User) with a standard resource
(via UsersController). You also create a SessionController that
manages only the concept of a 'user session' but has no persistent
data... and thus no model behind it.

HTH,
AndyV