mongoid_socializer_actions 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +22 -13
- data/lib/mongoid_socializer_actions/version.rb +1 -1
- data/mongoid_socializer_actions.gemspec +3 -3
- metadata +8 -8
data/Readme.md
CHANGED
@@ -1,14 +1,22 @@
|
|
1
1
|
# mongoid_socializer_actions
|
2
2
|
|
3
|
-
mongoid_socializer_actions
|
3
|
+
mongoid_socializer_actions gives ability to like, comment mongoid documents
|
4
4
|
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
8
|
-
Add
|
8
|
+
Add this line to your application's Gemfile:
|
9
9
|
|
10
10
|
gem 'mongoid_socializer_actions'
|
11
11
|
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
gem install mongoid_socializer_actions
|
19
|
+
|
12
20
|
|
13
21
|
## Requirements
|
14
22
|
|
@@ -25,7 +33,7 @@ Mongoid Likes provides two modules that you can mix in your model objects like t
|
|
25
33
|
include Mongoid::Liker
|
26
34
|
end
|
27
35
|
|
28
|
-
class
|
36
|
+
class Photo
|
29
37
|
include Mongoid::Document
|
30
38
|
|
31
39
|
include Mongoid::Likeable
|
@@ -34,40 +42,41 @@ Mongoid Likes provides two modules that you can mix in your model objects like t
|
|
34
42
|
You can now like objects like this:
|
35
43
|
|
36
44
|
user = User.create
|
37
|
-
|
45
|
+
photo = Photo.create
|
38
46
|
|
39
|
-
user.like(
|
47
|
+
user.like(photo)
|
40
48
|
|
41
49
|
You can query for likes like that:
|
42
50
|
|
43
|
-
|
51
|
+
photo.all_likers
|
44
52
|
# => [user]
|
45
53
|
|
46
|
-
|
54
|
+
photo.likers_count
|
47
55
|
# => 1
|
48
56
|
|
49
57
|
user.all_likes
|
50
|
-
# => [
|
58
|
+
# => [photo]
|
51
59
|
|
52
60
|
Also likes are polymorphic, so let's assume you have a second class `Album` that is including `Mongoid::Likeable` you can do something like this:
|
53
61
|
|
54
62
|
album = Album.create
|
55
63
|
user.like(album)
|
56
64
|
user.all_likes
|
57
|
-
# => [
|
65
|
+
# => [photo, album]
|
58
66
|
|
59
67
|
user.all_likes_by_model(Album)
|
60
68
|
# => [album]
|
61
69
|
|
62
|
-
user.
|
70
|
+
user.photo_likes_count
|
63
71
|
# => 1
|
64
72
|
|
65
|
-
user.
|
66
|
-
# => [
|
73
|
+
user.all_photo_likes
|
74
|
+
# => [photo]
|
67
75
|
|
68
76
|
You get the idea. Have a look at the specs to see some more examples.
|
69
77
|
|
70
78
|
# TODOs
|
71
79
|
|
72
80
|
- Implement commentable
|
73
|
-
- Implement sharable
|
81
|
+
- Implement sharable
|
82
|
+
- Implement taggable
|
@@ -10,9 +10,9 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
11
|
s.authors = ['Sreehari B']
|
12
12
|
s.email = ['sreehari@activesphere.com']
|
13
|
-
s.homepage = 'https://github.com/
|
14
|
-
s.summary = %q{
|
15
|
-
s.description = %q{Add liking ability to Mongoid documents.
|
13
|
+
s.homepage = 'https://github.com/sreehari/mongoid_socializer_actions'
|
14
|
+
s.summary = %q{Ability to comment, like, share, tag mongoid documents}
|
15
|
+
s.description = %q{Add liking, commentable, sharabel, tagabel ability to Mongoid documents.}
|
16
16
|
|
17
17
|
s.add_dependency 'mongoid', '~> 3.0'
|
18
18
|
s.add_dependency 'activesupport', '~> 3.2'
|
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: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2013-02-08 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mongoid
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152615400 !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: *2152615400
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &2152614860 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,8 +32,8 @@ dependencies:
|
|
32
32
|
version: '3.2'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
36
|
-
description: Add liking ability to Mongoid documents.
|
35
|
+
version_requirements: *2152614860
|
36
|
+
description: Add liking, commentable, sharabel, tagabel ability to Mongoid documents.
|
37
37
|
email:
|
38
38
|
- sreehari@activesphere.com
|
39
39
|
executables: []
|
@@ -58,7 +58,7 @@ files:
|
|
58
58
|
- spec/mongoid/models/user.rb
|
59
59
|
- spec/mongoid/mongoid_socializer_actions/likes_spec.rb
|
60
60
|
- spec/spec_helper.rb
|
61
|
-
homepage: https://github.com/
|
61
|
+
homepage: https://github.com/sreehari/mongoid_socializer_actions
|
62
62
|
licenses: []
|
63
63
|
post_install_message:
|
64
64
|
rdoc_options: []
|
@@ -82,7 +82,7 @@ rubyforge_project:
|
|
82
82
|
rubygems_version: 1.8.10
|
83
83
|
signing_key:
|
84
84
|
specification_version: 3
|
85
|
-
summary:
|
85
|
+
summary: Ability to comment, like, share, tag mongoid documents
|
86
86
|
test_files:
|
87
87
|
- spec/config/mongoid.yml
|
88
88
|
- spec/mongoid/models/photo.rb
|