dwbutler/groupify — pull request #5 by reed (2014-03-27 21:59:29+00:00)
Title: Allow model instances to access other models with names matching Groupify modules

Hey, thanks for writing this gem. Let me explain the issue I ran into. Given this setup:

```ruby
class Group < ActiveRecord::Base
acts_as_group :members => [:users], :default_members => :users
end

class User < ActiveRecord::Base
acts_as_group_member
acts_as_named_group_member
end

class GroupMembership < ActiveRecord::Base
acts_as_group_membership
end

class SomeOtherARModel < ActiveRecord::Base
end

class PlainOldRubyObject
end
```

Instances of any of the first four classes can't access the Group or GroupMembership class, while PlainOldRubyObject instances can. You can test this in the console:

```irb
>> Group.new.instance_eval('Group')
=> Groupify::ActiveRecord::Group

>> User.new.instance_eval('Group')
=> Groupify::ActiveRecord::Group

>> GroupMembership.new.instance_eval('Group')
=> Groupify::ActiveRecord::Group

>> SomeOtherARModel.new.instance_eval('Group')
=> Groupify::ActiveRecord::Group

>> PlainOldRubyObject.new.instance_eval('Group')
=> Group(id: integer, type: string)
```

To fix this, all I did was wrap the `included` block and the ClassMethods module inside a module called Base and then have ActiveRecord::Base include just it instead of all the Groupify modules. Now, running all of those commands returns the Group class and not the Groupify module.

Let me know what you think, or if you want me to change anything.