acts_as_commentable_more 1.2.9 → 1.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2750b089cf878b76a9fe9b4389c9bbf5e0024e6f
|
4
|
+
data.tar.gz: 4ab4b84728c4d3a96ce1937196143dc511bc15df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59387153a16d1a78b6d28ac39b4e1a8418864abe917c85f12cfcb31e806b22dcb729d2638d20867ed0f8a8024fdd837b0aa84e133481e1674b769ad21847b686
|
7
|
+
data.tar.gz: d53649cda904537fa2eac58b6babe7ffd9fe789d9f77168f8ba72bb5b3ab912d509f33fa40bc14fde3a3e82f7d92936a0b8790d8e25a5b01bba817c461a51a50
|
@@ -15,7 +15,7 @@ module ActsAsCommentableMore
|
|
15
15
|
mattr_accessor :aacm_association_options
|
16
16
|
|
17
17
|
default_commentable_options = { types: [], options: {}, as: nil, counter_cache: true }
|
18
|
-
default_association_options = { as: :commentable, dependent: :destroy, class_name: 'Comment' }
|
18
|
+
default_association_options = { as: :commentable, dependent: :destroy, class_name: 'Comment', order_by: {} }
|
19
19
|
|
20
20
|
self.aacm_commentable_options = default_commentable_options.merge(args.extract_options!)
|
21
21
|
self.aacm_association_options = default_association_options.merge(aacm_commentable_options[:options].compact)
|
@@ -16,13 +16,15 @@ module ActsAsCommentableMore
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def define_role_based_inflection_4(role, commantable_name, association_comment_name)
|
19
|
+
order_by_attrs = aacm_association_options[:order_by]
|
19
20
|
has_many "#{association_comment_name}".to_sym,
|
20
|
-
-> { includes(commantable_name, :user).where(role: role) },
|
21
|
+
-> { includes(commantable_name, :user).where(role: role).order(order_by_attrs) },
|
21
22
|
has_many_options(role)
|
22
23
|
end
|
23
24
|
|
24
25
|
def has_many_options(role)
|
25
|
-
|
26
|
+
association_options = aacm_association_options.except(:order_by)
|
27
|
+
{ before_add: Proc.new { |post, comment| comment.role = role } }.merge(association_options)
|
26
28
|
end
|
27
29
|
|
28
30
|
end
|
@@ -8,7 +8,7 @@ module ActsAsCommentableMore
|
|
8
8
|
aacm_commentable_options[:comment_model]
|
9
9
|
.includes(aacm_association_options[:as].to_sym, :user)
|
10
10
|
.where(aacm_association_options[:as].to_sym => self)
|
11
|
-
.order(
|
11
|
+
.order(aacm_association_options[:order_by])
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_commentable_more
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piya23300
|
8
8
|
autorequire: acts_as_commentable_more
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|