acts_as_commentable 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -0
- data/lib/comment_methods.rb +1 -1
- data/lib/commentable_methods.rb +3 -2
- metadata +1 -2
- data/tasks/acts_as_commentable_tasks.rake +0 -4
data/README.rdoc
CHANGED
data/lib/comment_methods.rb
CHANGED
@@ -10,7 +10,7 @@ module ActsAsCommentable
|
|
10
10
|
def self.included(comment_model)
|
11
11
|
comment_model.extend Finders
|
12
12
|
comment_model.scope :in_order, -> { comment_model.order('created_at ASC') }
|
13
|
-
comment_model.scope :recent, -> { comment_model.
|
13
|
+
comment_model.scope :recent, -> { comment_model.reorder('created_at DESC') }
|
14
14
|
end
|
15
15
|
|
16
16
|
def is_comment_type?(type)
|
data/lib/commentable_methods.rb
CHANGED
@@ -21,12 +21,13 @@ module Juixe
|
|
21
21
|
if !comment_roles.blank?
|
22
22
|
comment_roles.each do |role|
|
23
23
|
has_many "#{role.to_s}_comments".to_sym,
|
24
|
+
-> { where(role: role.to_s) },
|
24
25
|
{:class_name => "Comment",
|
25
26
|
:as => :commentable,
|
26
27
|
:dependent => :destroy,
|
27
|
-
:conditions => ["role = ?", role.to_s],
|
28
28
|
:before_add => Proc.new { |x, c| c.role = role.to_s }}
|
29
29
|
end
|
30
|
+
has_many :all_comments, {:as => :commentable, :dependent => :destroy, class_name: "Comment"}
|
30
31
|
else
|
31
32
|
has_many :comments, {:as => :commentable, :dependent => :destroy}
|
32
33
|
end
|
@@ -45,7 +46,7 @@ module Juixe
|
|
45
46
|
end
|
46
47
|
|
47
48
|
def #{method_name}_ordered_by_submitted
|
48
|
-
Comment.find_comments_for_commentable(self.class.name, id, "#{role.to_s}")
|
49
|
+
Comment.find_comments_for_commentable(self.class.name, id, "#{role.to_s}").order("created_at")
|
49
50
|
end
|
50
51
|
|
51
52
|
def add_#{method_name.singularize}(comment)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_commentable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -28,7 +28,6 @@ files:
|
|
28
28
|
- lib/generators/comment/templates/comment.rb
|
29
29
|
- lib/generators/comment/templates/create_comments.rb
|
30
30
|
- lib/generators/comment/USEGA
|
31
|
-
- tasks/acts_as_commentable_tasks.rake
|
32
31
|
- init.rb
|
33
32
|
- install.rb
|
34
33
|
homepage: http://www.juixe.com/techknow/index.php/2006/06/18/acts-as-commentable-plugin/
|