EppO/rolify — pull request #201 by ajh (2013-11-27 15:26:54+00:00)
Title: User class can be a STI subtype

Hi Epp0,

I'm trying out rolify for my app. We use active record and STI for our user classes and ran into the issue documented on the FAQ here: https://github.com/EppO/rolify/wiki/FAQ#does-rolify-support-sti- The `becomes` workaround does solve the problem, but I think this is nicer.

Use active_support's `class_attribute` for the adapter, which allows
`rolify` to be called on the User base class, and roles to be used on a
subclass.

Previously there was a problem where the rolify code would call
`self.class.adapter` on the subclass which would fail. class_attribute
fixes this by allowing subclasses to the the base class's adapter value.

Let me know what you think! I'm open to feedback and changes!

Thanks,

Andy