mongoid_socializer_actions 1.2.5 → 1.2.6
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.
data/app/models/comment.rb
CHANGED
|
@@ -5,6 +5,8 @@ module Mongoid
|
|
|
5
5
|
|
|
6
6
|
field :body, type: String
|
|
7
7
|
validates :body, presence: true
|
|
8
|
+
validates :commenter, presence: true
|
|
9
|
+
validates :commentable, presence: true
|
|
8
10
|
|
|
9
11
|
belongs_to :commenter, :class_name => Socializer.user_class_name, :inverse_of => :comments
|
|
10
12
|
belongs_to :commentable, :polymorphic => true
|
|
@@ -13,4 +15,4 @@ module Mongoid
|
|
|
13
15
|
commentable_type.constantize.find(commentable_id)
|
|
14
16
|
end
|
|
15
17
|
end
|
|
16
|
-
end
|
|
18
|
+
end
|
|
@@ -13,8 +13,7 @@ module Mongoid
|
|
|
13
13
|
# => @john.comment_on(@photo, "Beautiful")
|
|
14
14
|
def comment_on(model, comment_body)
|
|
15
15
|
model.before_commented_by(self) if model.respond_to?('before_commented_by')
|
|
16
|
-
comment =
|
|
17
|
-
comments << comment
|
|
16
|
+
comment = self.comments.create(body: comment_body, commentable: model)
|
|
18
17
|
model.inc(:comments_count, 1)
|
|
19
18
|
self.inc(:comments_count, 1)
|
|
20
19
|
model.after_commented_by(self) if model.respond_to?('after_commented_by')
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mongoid_socializer_actions
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.6
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,11 +9,11 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-04-
|
|
12
|
+
date: 2013-04-10 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: mongoid
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &2156031320 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ~>
|
|
@@ -21,10 +21,10 @@ dependencies:
|
|
|
21
21
|
version: '3.0'
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *2156031320
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
26
|
name: activesupport
|
|
27
|
-
requirement: &
|
|
27
|
+
requirement: &2156029960 !ruby/object:Gem::Requirement
|
|
28
28
|
none: false
|
|
29
29
|
requirements:
|
|
30
30
|
- - ~>
|
|
@@ -32,7 +32,7 @@ dependencies:
|
|
|
32
32
|
version: '3.2'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
|
-
version_requirements: *
|
|
35
|
+
version_requirements: *2156029960
|
|
36
36
|
description: Like, comment, share mongoid documents.
|
|
37
37
|
email:
|
|
38
38
|
- sreehari@activesphere.com
|