mongoid_socializer_actions 1.2.5 → 1.2.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 = model.comments.create(body: comment_body)
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')
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module MongoidSocializerActions
3
- VERSION = "1.2.5"
3
+ VERSION = "1.2.6"
4
4
  end
5
5
  end
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.5
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-08 00:00:00.000000000 Z
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: &2152121820 !ruby/object:Gem::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: *2152121820
24
+ version_requirements: *2156031320
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &2152120500 !ruby/object:Gem::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: *2152120500
35
+ version_requirements: *2156029960
36
36
  description: Like, comment, share mongoid documents.
37
37
  email:
38
38
  - sreehari@activesphere.com