Authlogic generators? All of the cool kids are doing it.

peer_pressureLately I’ve been getting a lot of pressure to add a generator to Authlogic. One of the big things I “tout” about Authlogic is the fact that is does not need generators, not anymore than any other RESTful controller you create. Authlogic can pull this off because it’s intuitive, it works just like every other model you have in your application. Unless you want to customize how it works, there’s no learning curve. If you know how to set up a RESTful controller for an ORM model, then you know how to set up a RESTful controller for an Authlogic model.

In my opinion generators are meant to be a starting point for repetitive tasks that have no sustainable pattern. By repetitive, I mean repetitive in a single application. Ex: multiple controllers, multiple models, etc. 95% of applications are going to create 1 Authlogic model and 1 controller for that model. If they are creating more than one, it is mostly likely for a highly unique situation where a generator would be of no use. Which leads me to my question:

Why not just create your own personalized base application or template that you can start from when you need to start a new application?

This is exactly why rails templates were created. They were created for this exact problem. A generator is never going to please everyone, and if it does, it would have a million options and be extremely complicated. Also, I don’t know about you, but I am extremely picky about my code. Even if my code and someone else’s code does the exact same thing, I want my code formatted a certain way. This is a big reason why I dislike restful_authentication. All of this code, that I do not like, gets inserted into my application. It just feels dirty. I’d much rather build my own authentication solution into a base app, that I like, and use that in my next application.

I just haven’t been convinced that creating a generator for Authlogic is a good use of my time. If you can convince me otherwise I’ll gladly do it. It’s not that I don’t want to spend the time, its that I truly feel a base app or a rails template is a better solution.

What do you think?

  • Share/Save/Bookmark


8 Responses to “Authlogic generators? All of the cool kids are doing it.”

  1. Hector Gomez says:

    I am of the same opinion that each developer or team should create a rails template to setup authlogic for their requirements (code, logic, tests, etc).

    I have my rails template for authlogic in github: http://github.com/hectoregm/rails-templates/tree/master

  2. Nick Hoffman says:

    The existence of generators in restful_authentication is exactly why I looked into alternatives.

    When I read about Authlogic’s design and lack of generators, I said “THIS makes sense”, and switched.

  3. Joe says:

    Seriously. Generators suck and I fully agree with Nick’s above comment. But! a generator for an acts_as_authentic model… just giving me those baseline table columns, would save me some copy paste time.

  4. Charlie says:

    The important thing is that I understand what’s going on. As opposed to magic.

    If there is a generator like Joe describes, I want the docs to say something like, “Run this generator command. It will do the following:” followed by a detailed description of what the generator will do and why.

    If not, then the docs can just tell me what to do directly. The stuff the generator would have done.

    Either way, I want to know what’s going on!

  5. hendry says:

    Hey Ben,
    first of all thanks for the great DRY Authentication Plugin AuthLogic.
    I’m implementing a WebApp using this Plugin… everything works just fine until the thing with Unit Testing…. I just can’t have a User logged in within a Site that require a User LogIn… Would You mind tp give me a clue… thanks a lot

  6. lolcatz says:

    Generators suck. If i would need generatord i would stay on restful_auth.

    Thanks a lot for a good work Ben & contributors!

  7. lolcatz says:

    Generators suck. If I would need generators, I would stay on restful_auth.

    Thanks a lot for a good work Ben & contributors!

  8. Zoran says:

    No generators please!!