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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dac3c7add84b70827b1b3a544a95af49ba0ae805
4
- data.tar.gz: d47ebf21a0ffff88f0d467478db54bb6007b154a
3
+ metadata.gz: 1a65d6a8042cc1bc6b6f707570d5967d7d682737
4
+ data.tar.gz: 2d54c395882d1868f12ea7e2d3c7b3c6e95fcb2a
5
5
  SHA512:
6
- metadata.gz: 3e755c87fad0900ad37e3b031518727a4559b53caa49d704cd49caf46a4f7b34d265be6cf5a2bfe9b38a100509539e91535366b9b166227c59a9534428f5b8c6
7
- data.tar.gz: 058b7b9156bdd6d0739f7f02aa444461b2e89672e17b5f8b589b994397e2ea9443e57aaf1c7e1a34f18bc18581e7ba7761440c72f8d06a86658784cd55dbb29c
6
+ metadata.gz: df6e29ba8a06a338287c535a5d089ba1376a728f9ca36c098edfb921e61c25ea85d0e61fa260aeb8e7a7cd8764cf96e1093802f73be8efd221338f9213df18e3
7
+ data.tar.gz: cea49e53db070c6a4052e491f911818755f1bbaf51d542986d61a10839dd224fc53c22a41619ff2e0d1d5b8e0eff6e8335dfbffe95e925086f4699f4a434515b
@@ -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
- 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
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,5 +1,5 @@
1
1
  module Mongoid
2
2
  module MongoidSocializerActions
3
- VERSION = "2.0.1"
3
+ VERSION = "2.0.2"
4
4
  end
5
5
  end
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  # -*- encoding: utf-8 -*-
4
- $:.push File.expand_path('../lib', __FILE__)
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 = ['sreehari@activesphere.com']
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.}
@@ -7,9 +7,9 @@ require 'database_cleaner'
7
7
 
8
8
  models_folder = File.join(File.dirname(__FILE__), 'mongoid/models')
9
9
 
10
- $LOAD_PATH.unshift(File.dirname(__FILE__))
11
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
12
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'app'))
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.1
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: 2013-11-28 00:00:00.000000000 Z
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
- - sreehari@activesphere.com
43
+ - sreehari0514@gmail.com
44
44
  executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []