Enforcers now raise Transgression when the current_user is nil. #4

Merged
merged 1 commit into from Sep 7, 2011

Conversation

Projects
None yet
2 participants
Contributor

jopotts commented Sep 7, 2011

Hi John,

Thanks for the great gem. Love the simplicity of it, yet does everything you'd need.

The way it expected there to always be a current_user was getting to me though so I've made this change to raise the transgression error (instead of no method on nil error) when the current_user is nil (ie. nobody's logged in).

I've updated the tests accordingly. The old tests btw all passed with the change in place, so the new ones are to prevent regression.

I also added a bit of help on adding checks on class methods as I think it's probably a common thing.

Cheers,
Jo Potts
@jopotts
jopotts@gmail.com

Looks like 2 changes in one, which confused me for a bit, but I think I'm good with this. I'll check it out locally and let you know. Thanks!

jnunemaker merged commit c93ee06 into jnunemaker:master Sep 7, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment