About "Rails Recipes", Fowler, 2006

RichardOnRails wrote:

I'm following Chad's Recipe 31, "Authenticating your Users". After getting some of it working, I noticed that he had put some of his models and controllers under a separate Authentication directory under the directory created originally with, say, a "rails MyApp" command.

In Recipe 31? I just refreshed my memory of it. The code is split between the model, view and controller directories with the majority of it being in the model. I didn't see any files located outside of those directories and all of the directories in my copy of the book are in the standard locations. So your statement confuses me.

Some other authentication schemes use code located in lib/somefile.rb which I think may be what you are asking about. I wish you had said exactly what file you were talking about because then a web search would have helped me locate it. Those files in the lib directory are loaded as additional library code.

Question: Am I likely to run into trouble if I ignore creation of an Authentication dir. and issue a command like ruby script/generate model User username:string password_salt:string password_hash:string with my working directory set to "MyApp"?

No. That should be okay. Your command above creates a model and that is just standard behavior. (I am sure you are going to have other fields too. Personally I find having a last_login_at field useful along with an enabled boolean.)

Bob