acts_as_readable 2.5.0 → 2.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/acts_as_readable/acts_as_readable.rb +11 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30458b57470ac5d7b6bb60a763f96b982c00eb79cddf118dac4cb1a8c3ce987b
|
4
|
+
data.tar.gz: 23a3911dd0b46152113dbacea0fe6ae40aedbea3be5a8ed045b749f8094b15b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67cc32a787dac99c949d85d4f1159aefe2a04abd3511c65ccf7a14b0f357d44e789163893123496408a5f42fa9af83314aa5ae1fe2b78bb520809b007c2cf51d
|
7
|
+
data.tar.gz: 40a91e90aec4320f150a81c0cb8b5aa533e594e8dee429dd4d37854dec8af4059e7bb8b48da72fe04cc72b23830f0014b70ab989f341180c70104e8d08bc40cb
|
@@ -107,15 +107,24 @@ module ActsAsReadable
|
|
107
107
|
reading.updated_at = Time.now # Explicitly set the read time to now in order to force a save in case we haven't changed anything else about the reading
|
108
108
|
reading.state = :read
|
109
109
|
reading.save!
|
110
|
+
@read_by_retried = false
|
110
111
|
rescue ActiveRecord::RecordNotUnique
|
111
|
-
|
112
|
-
|
112
|
+
unless @read_by_retried
|
113
|
+
@read_by_retried = true
|
114
|
+
retry
|
115
|
+
end
|
113
116
|
end
|
114
117
|
|
115
118
|
def unread_by!(user)
|
116
119
|
reading = Reading.find_or_initialize_by(:user_id => user.id, :readable_id => self.id, :readable_type => HelperMethods.readable_type(self.class))
|
117
120
|
reading.state = :unread
|
118
121
|
reading.save!
|
122
|
+
@unread_by_retried = false
|
123
|
+
rescue ActiveRecord::RecordNotUnique
|
124
|
+
unless @unread_by_retried
|
125
|
+
@unread_by_retried = true
|
126
|
+
retry
|
127
|
+
end
|
119
128
|
end
|
120
129
|
|
121
130
|
def read_by?(user)
|