#36 ✓resolved
GMaples

documentation of callback/validations

Reported by GMaples | February 4th, 2009 @ 01:25 AM

I love the plugin, thanks. I am trying to add administrative banning to the authorization. I'd think the code should be something like

before_create :banned?

in session model, right? It would be amazingly helpful to new people like myself to have some basic documentation, or even a good hint beyond read-the-rdoc to get us going.

Thanks in advance

Comments and changes to this ticket

  • Ben Johnson

    Ben Johnson February 8th, 2009 @ 04:32 AM

    • State changed from “new” to “resolved”

    Hi, I spent a lot of time on the documentation and the README is pretty basic, delving into the RDOC is where it gets a little more detailed. If you wouldn't mind telling me what confused you in the documentation so I can update it, that would be great.

    Anyways, I tried to mimic the AR style as best as I could. You could do a before_validation:

    before_validation :validate_banned

    private def validate_banned errors.add_to_base("You have been banned") if record && record.banned? end

    This goes in your session model. You could also create a validate method and put everything in there. Hope this helps.

  • Ben Johnson

    Ben Johnson February 8th, 2009 @ 04:36 AM

    Update from the repo, I just added a validate callback so it feels more like AR. Instead of a before_validation you can just call validate.

  • smason

    smason September 23rd, 2018 @ 05:13 AM

    Inspiring the more and great objectives about helpful topics and essay methods, if you want to know about how to write essay visit the essay guard writing help blog. Really very impressive and helpful for all,keep follow and get more.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Object based authentication solution that handles all of the non sense for you. It's as easy as ActiveRecord is with a database.

People watching this ticket

Pages