Fixed Rails 4.1 HasAndBelongsToMany behavior

In Rails 4.1, HasAndBelongsToMany relationships define a class that descends of ActiveRecord. This new behavior raised a bug.