acts_as_favoritor 5.0.2 → 5.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c785314efa34b1f88cfee3d6c39acef924fb989e6a2654c65241a07facd707b0
|
4
|
+
data.tar.gz: 28dfbd0a05eab1723e871df1aec6657aabae38875402f03f5f2347ccedb7bc22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af2a517dc943fa69ea7d5442beced5d086a31a9586e1587fecf4ae3c0ad57ab9579099731ec5d92e794075b3d804e0facf7605fa196cdb3531edfb1f4d9855d0
|
7
|
+
data.tar.gz: 5e19c65f8f122686cf452f3690f18856e0e235d443e0772c8e4c4468d1b43bea2a46653e495f68d18dc0591ac6e725c2f53f8e3de7cbc5f6ddc0c2b89b9664a4
|
@@ -50,10 +50,11 @@ module ActsAsFavoritor
|
|
50
50
|
self.class.build_result_for_scopes(scopes || scope) do |s|
|
51
51
|
return nil if self == favoritable
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
favorites.for_favoritable(favoritable).send("#{s}_list")
|
54
|
+
.first_or_create! do |new_record|
|
55
|
+
inc_cache(favoritable, s) if ActsAsFavoritor.configuration.cache
|
56
|
+
new_record
|
57
|
+
end
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
@@ -65,7 +66,7 @@ module ActsAsFavoritor
|
|
65
66
|
return nil unless favorite_record.present?
|
66
67
|
|
67
68
|
result = favorite_record.destroy!
|
68
|
-
dec_cache(favoritable, s) if ActsAsFavoritor.configuration.cache
|
69
|
+
dec_cache(favoritable, s) if ActsAsFavoritor.configuration.cache && result.destroyed?
|
69
70
|
result
|
70
71
|
end
|
71
72
|
end
|
@@ -19,7 +19,8 @@ class ActsAsFavoritorMigration < ActiveRecord::Migration<%= migration_version %>
|
|
19
19
|
['favoritable_id', 'favoritable_type'],
|
20
20
|
name: 'fk_favoritables'
|
21
21
|
add_index :favorites,
|
22
|
-
['
|
22
|
+
['favoritable_type', 'favoritable_id', 'favoritor_type',
|
23
|
+
'favoritor_id', 'scope'],
|
23
24
|
name: 'uniq_favorites__and_favoritables', unique: true
|
24
25
|
end
|
25
26
|
|