EppO/rolify — pull request #255 by zlotnika (2014-05-10 21:31:47+00:00)
Title: Allow inheritance of resourcify

I had a structure like this:

```ruby
class Forum < ActiveRecord::Base
resourcify
end

class Topic < Forum
end
```

And wanted `Topic` to inherit the `resourcify` initialization from `Forum`. It worked as is, in that:

```ruby
User.last.add_role :admin, Topic.last
User.last.has_role? :admin, Topic.last
# => true
```

The **Resource role queries**, however, failed:

```ruby
Topic.last.roles
# => []
Topic.last.applied_roles
# => crash!
Topic.with_role :admin, User.last
# => crash!
```

This patch makes `::with_role`, `#applied_roles` return what you would expect as well as adding a `#roles_for_class` to be used instead of `#roles`:

```ruby
Topic.last.roles
# => []
Topic.last.roles_for_class
# => [ list of roles that are only bound to a topic instance ]
Topic.last.applied_roles
# => [ list of roles bound to a topic instance and to the Topic class ]
Topic.with_role :admin, User.last
# => [ list of roles that are bound to any Topic instance or to the Topic class with "admin" as a role name and belongs to User.last roles ]
```