Re: can all methods be made to fit REST?

Michael Glaesemann
2007-10-18T17:43:47Z

On Oct 18, 2007, at 12:29 , Ant wrote:

> For example can anybody think what model I would use for
> forgot_password and reset_password. I have a user model that has a
> password as a field. I do not really want to have a password model
> since I guess this is supposed to map to a password table in the
> database.

There''s no reason to have a one-to-one correspondence between
controllers and models, nor between models and database tables. I''ve
used a separate AuthenticationsController (with new, create, and
destroy actions) to handle logins. Works well.

Forgotten/reset password, depending on what you''re doing, you might
have a ForgottenPasswordNotificationController with new and create
actions to send out notifications, and a separate PasswordsController
(perhaps nested under your UsersController?) that has edit and update
actions? Or perhaps PasswordsController#new posts to #create which in
turn sends the notification? Just ideas here, and I haven''t really
thought through them too far, but it''s a start. The thing to keep in
mind is the resource that you''re acting on.

Hope this helps. There''s no reason you have to map everything to
REST, but many times you can if you want.

Michael Glaesemann
grzm seespotcode net