Skip to content

Commit

Permalink
Default to not requiring the presence of the deleter attribute
Browse files Browse the repository at this point in the history
Fixes delynn#29.
  • Loading branch information
lowjoel committed Oct 18, 2017
1 parent e3c808e commit 752f1e3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/active_record/userstamp/stampable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ def add_userstamp_associations(options)
associations.first
belongs_to :updater, relation_options.reverse_merge(foreign_key: config.updater_attribute) if
associations.second
belongs_to :deleter, relation_options.reverse_merge(foreign_key: config.deleter_attribute) if
associations.third
if associations.third
relation_options.reverse_merge!(required: false) if ActiveRecord::VERSION::MAJOR >= 5 ||
(ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR >= 2)
belongs_to :deleter, relation_options.reverse_merge(foreign_key: config.deleter_attribute)
end
end
end

Expand Down

0 comments on commit 752f1e3

Please sign in to comment.