acts_as_commentable_more 1.2.10 → 1.2.11
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d39f1a222c8d9d671deae2ee1722eeace2646b7
|
4
|
+
data.tar.gz: 92d1b8c161a6b93f1bc9b50d6cf44f688e3529c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42688950a06195fe237c7ec1e8f8935f0cbcddb762ca5f2b672ae07edb7044934ae3b3163e34b4defbe450e0447b5b584be875437c58ee09bca0c026355b02b6
|
7
|
+
data.tar.gz: 8561dab35ba6dfd1033be7bd0c6b7e7c0652bfc74c912def1ba76a2eb1978db5fa1a0f461e01e15e6a5197a22172affd0806e5db38c0b090e49dbb760ba26d98
|
@@ -6,7 +6,6 @@ module ActsAsCommentableMore
|
|
6
6
|
module ClassMethods
|
7
7
|
include Helpers::Post::AssociationsHelper
|
8
8
|
include Helpers::Post::MethodsHelper
|
9
|
-
include Helpers::Post::ScopesHelper
|
10
9
|
include Helpers::Comment::CacheCounterHelper
|
11
10
|
include Helpers::Comment::InstanceMethodsHelper
|
12
11
|
|
@@ -40,7 +39,7 @@ module ActsAsCommentableMore
|
|
40
39
|
### many roles comment ###
|
41
40
|
###########################
|
42
41
|
# scope method for post model
|
43
|
-
|
42
|
+
post_define_based_inflection(aacm_commentable_options[:association_comment_name])
|
44
43
|
|
45
44
|
aacm_commentable_options[:comment_roles].each do |role|
|
46
45
|
# association for post model
|
@@ -5,6 +5,21 @@ module ActsAsCommentableMore
|
|
5
5
|
|
6
6
|
private
|
7
7
|
|
8
|
+
def post_define_based_inflection(association_comment_name)
|
9
|
+
commantable_name = aacm_association_options[:as].to_sym
|
10
|
+
send("define_based_inflection_#{Rails.version.first}", commantable_name, association_comment_name)
|
11
|
+
end
|
12
|
+
|
13
|
+
def define_based_inflection_4(commantable_name, association_comment_name)
|
14
|
+
order_by_attrs = aacm_association_options[:order_by]
|
15
|
+
association_options = aacm_association_options.except(:order_by)
|
16
|
+
has_many "#{association_comment_name}".to_sym,
|
17
|
+
-> { order(order_by_attrs) },
|
18
|
+
association_options
|
19
|
+
end
|
20
|
+
|
21
|
+
##==========================
|
22
|
+
##==========================
|
8
23
|
def post_define_role_based_inflection(role, association_comment_name)
|
9
24
|
commantable_name = aacm_association_options[:as].to_sym
|
10
25
|
send("define_role_based_inflection_#{Rails.version.first}", role, commantable_name, association_comment_name)
|
@@ -18,7 +33,7 @@ module ActsAsCommentableMore
|
|
18
33
|
def define_role_based_inflection_4(role, commantable_name, association_comment_name)
|
19
34
|
order_by_attrs = aacm_association_options[:order_by]
|
20
35
|
has_many "#{association_comment_name}".to_sym,
|
21
|
-
-> {
|
36
|
+
-> { where(role: role).order(order_by_attrs) },
|
22
37
|
has_many_options(role)
|
23
38
|
end
|
24
39
|
|
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.11
|
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-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -81,7 +81,6 @@ files:
|
|
81
81
|
- lib/acts_as_commentable_more/helpers/comment/instance_methods_helper.rb
|
82
82
|
- lib/acts_as_commentable_more/helpers/post/associations_helper.rb
|
83
83
|
- lib/acts_as_commentable_more/helpers/post/methods_helper.rb
|
84
|
-
- lib/acts_as_commentable_more/helpers/post/scopes_helper.rb
|
85
84
|
- lib/acts_as_commentable_more/version.rb
|
86
85
|
- lib/generators/commentable/USAGE
|
87
86
|
- lib/generators/commentable/commentable_generator.rb
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module ActsAsCommentableMore
|
2
|
-
module Helpers
|
3
|
-
module Post
|
4
|
-
module ScopesHelper
|
5
|
-
|
6
|
-
def post_define_all_scope
|
7
|
-
redefine_method("all_#{aacm_commentable_options[:association_comment_name]}") do
|
8
|
-
aacm_commentable_options[:comment_model]
|
9
|
-
.includes(aacm_association_options[:as].to_sym, :user)
|
10
|
-
.where(aacm_association_options[:as].to_sym => self)
|
11
|
-
.order(aacm_association_options[:order_by])
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|