Skip to content

Commit

Permalink
Fix named group support in Rails 5
Browse files Browse the repository at this point in the history
Rails 5 made `belongs_to` associations required by default. When using named groups, the group association is expected to be empty. This fixes the issue in a Rails 4 compatible way by adding `required: false`

Fixes #65
  • Loading branch information
dwbutler committed Aug 4, 2017
1 parent f2c64af commit e3240ab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/groupify/adapter/active_record/group_membership.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module GroupMembership

included do
belongs_to :member, polymorphic: true
belongs_to :group, polymorphic: true
belongs_to :group, polymorphic: true, required: false
end

def membership_type=(membership_type)
Expand Down

0 comments on commit e3240ab

Please sign in to comment.