views:

40

answers:

3

I starting building my app using nifty-generators for the user authentication because I'm new to Rails and it was the easiest approach. Now, we're looking to launch the app and I want to implement the popular Restful Authentication because we need some of the features it offers.

I've never upgraded an existing model in this way, and I'm wondering what the best approach would be. Should I strip out the user model-related stuff? Or will Restful Authentication just overwrite the commonly name items? Of course, I can go into the app and make tweaks based on any changes.

Generally, how would more experienced Rails coders approach this?

Thanks!

A: 

I would add another model and relate that via an has_one-relation..

f.e. adding a Account-Model (if your user-model already exists)

class Account << AR
  belongs_to :user
end

class User << AR
  has_one :account
end
Lichtamberg
A: 

If you've got a fair amount of tests, there shouldn't be an issue. Your suite will let you know if you've done something wrong.

Personally I would implement Restful Auth, by hand, on another project. Play around with it until you understand how it affects your user model, then copy over the code and any migrations you need.

A nice tutorial on Restful Auth and some cool extensions is here

austinfromboston
Thanks. Very helpful for starting fresh with restful authentication.
MikeH
+1  A: 

You might want to check out Authlogic instead. There's a good railscast episode where he implements Authlogic with nifty generators.

Andy Gaskell
Thanks. I decided to start over with a new app and go with restful authentication from the beginning. But thanks for the link to the Railscast.
MikeH