mongoid_socializer_actions 2.0.1 → 2.0.2
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 +4 -4
- data/app/models/share.rb +3 -0
- data/lib/mongoid_socializer_actions/commenter.rb +8 -8
- data/lib/mongoid_socializer_actions/sharer.rb +1 -1
- data/lib/mongoid_socializer_actions/version.rb +1 -1
- data/mongoid_socializer_actions.gemspec +2 -2
- data/spec/spec_helper.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a65d6a8042cc1bc6b6f707570d5967d7d682737
|
4
|
+
data.tar.gz: 2d54c395882d1868f12ea7e2d3c7b3c6e95fcb2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df6e29ba8a06a338287c535a5d089ba1376a728f9ca36c098edfb921e61c25ea85d0e61fa260aeb8e7a7cd8764cf96e1093802f73be8efd221338f9213df18e3
|
7
|
+
data.tar.gz: cea49e53db070c6a4052e491f911818755f1bbaf51d542986d61a10839dd224fc53c22a41619ff2e0d1d5b8e0eff6e8335dfbffe95e925086f4699f4a434515b
|
data/app/models/share.rb
CHANGED
@@ -2,6 +2,9 @@ module Mongoid
|
|
2
2
|
class Share
|
3
3
|
include Mongoid::Document
|
4
4
|
|
5
|
+
validates :sharer, presence: true
|
6
|
+
validates :sharable, presence: true
|
7
|
+
|
5
8
|
belongs_to :sharer, :class_name => Socializer.user_class_name, :inverse_of => :shares
|
6
9
|
belongs_to :sharable, :polymorphic => true
|
7
10
|
end
|
@@ -12,14 +12,14 @@ module Mongoid
|
|
12
12
|
# Example:
|
13
13
|
# => @john.comment_on(@photo, "Beautiful")
|
14
14
|
def comment_on(model, comment_body)
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
model.before_commented_by(self) if model.respond_to?('before_commented_by')
|
16
|
+
comment = self.comments.create(body: comment_body, commentable: model)
|
17
|
+
model.inc(:comments_count, 1)
|
18
|
+
self.inc(:comments_count, 1)
|
19
|
+
model.after_commented_by(self) if model.respond_to?('after_commented_by')
|
20
|
+
self.before_comment(model) if self.respond_to?('before_comment')
|
21
|
+
self.after_comment(model) if self.respond_to?('after_comment')
|
22
|
+
comment
|
23
23
|
end
|
24
24
|
|
25
25
|
# Delete comment a model
|
@@ -12,7 +12,7 @@ module Mongoid
|
|
12
12
|
# => @john.share(@photo)
|
13
13
|
def share(model)
|
14
14
|
model.before_shared_by(self) if model.respond_to?('before_shared_by')
|
15
|
-
shares << model.shares.create!
|
15
|
+
shares << model.shares.create!(sharer: self)
|
16
16
|
model.inc(:shares_count, 1)
|
17
17
|
model.after_shared_by(self) if model.respond_to?('after_shared_by')
|
18
18
|
self.before_share(model) if self.respond_to?('before_share')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
# -*- encoding: utf-8 -*-
|
4
|
-
$:.
|
4
|
+
$:.unshift File.expand_path('../lib', __FILE__)
|
5
5
|
require 'mongoid_socializer_actions/version'
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.version = Mongoid::MongoidSocializerActions::VERSION
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
11
|
s.authors = ['Sreehari B']
|
12
|
-
s.email = ['
|
12
|
+
s.email = ['sreehari0514@gmail.com']
|
13
13
|
s.homepage = 'https://github.com/sreehari/mongoid_socializer_actions'
|
14
14
|
s.summary = %q{Ability to comment, like, share, tag mongoid documents}
|
15
15
|
s.description = %q{Like, comment, share mongoid documents.}
|
data/spec/spec_helper.rb
CHANGED
@@ -7,9 +7,9 @@ require 'database_cleaner'
|
|
7
7
|
|
8
8
|
models_folder = File.join(File.dirname(__FILE__), 'mongoid/models')
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
$:.unshift(File.dirname(__FILE__))
|
11
|
+
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
12
|
+
$:.unshift(File.join(File.dirname(__FILE__), '..', 'app'))
|
13
13
|
require 'pry-rails'
|
14
14
|
|
15
15
|
Mongoid.load! File.expand_path('../config/mongoid.yml', __FILE__), :test
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_socializer_actions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sreehari B
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
version: '3.2'
|
41
41
|
description: Like, comment, share mongoid documents.
|
42
42
|
email:
|
43
|
-
-
|
43
|
+
- sreehari0514@gmail.com
|
44
44
|
executables: []
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|