Skip to content

Commit 3687747

Browse files
add touch option on message model
1 parent ef72704 commit 3687747

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

spec/models/message.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ class Message
66
field :to
77

88
if Mongoid::Compatibility::Version.mongoid6_or_newer?
9-
belongs_to :user, optional: true
9+
belongs_to :user, optional: true, touch: true
1010
else
11-
belongs_to :user, touch: true
11+
belongs_to :user
1212
end
1313

1414
validates :identifier, uniqueness: { message: 'uniqueness' }

spec/unit/associations_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
describe Message do
5050
if Mongoid::Compatibility::Version.mongoid6_or_newer?
51-
it { is_expected.to belong_to(:user).with_optional }
51+
it { is_expected.to belong_to(:user).with_optional.with_touch(true) }
5252
end
5353
end
5454
end

0 commit comments

Comments
 (0)