socialization 0.3.0 → 0.4.0
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/README.rdoc +5 -5
- data/demo/demo_app/Gemfile +1 -1
- data/demo/demo_app/app/models/comment.rb +1 -1
- data/demo/demo_app/db/migrate/20120221200644_create_mentions.rb +3 -3
- data/demo/demo_app/db/schema.rb +3 -3
- data/generators/socialization/templates/migration_mentions.rb +3 -3
- data/lib/socialization/follower.rb +7 -0
- data/lib/socialization/hello.rb +3 -3
- data/lib/socialization/liker.rb +7 -0
- data/lib/socialization/mention_store.rb +3 -3
- data/lib/socialization/mentionable.rb +6 -6
- data/lib/socialization/{mentionner.rb → mentioner.rb} +14 -7
- data/lib/socialization/version.rb +1 -1
- data/test/follow_test.rb +10 -1
- data/test/like_test.rb +9 -0
- data/test/mention_test.rb +42 -33
- data/test/test_helper.rb +9 -9
- metadata +15 -15
data/README.rdoc
CHANGED
@@ -69,7 +69,7 @@ Allow a model to be mentioned:
|
|
69
69
|
Allow a model to mention:
|
70
70
|
class Comment < ActiveRecord::Base
|
71
71
|
...
|
72
|
-
|
72
|
+
acts_as_mentioner
|
73
73
|
...
|
74
74
|
end
|
75
75
|
|
@@ -130,9 +130,9 @@ Find out if an objects likes
|
|
130
130
|
All likers
|
131
131
|
movie.likers(User)
|
132
132
|
|
133
|
-
===
|
133
|
+
=== acts_as_mentioner Methods
|
134
134
|
|
135
|
-
<b>Note that a "
|
135
|
+
<b>Note that a "mentioner" is the object containing the mention and not necessarily the actor. For example, John mentions Jane in a comment. The mentioner is the comment object, NOT John.</b>
|
136
136
|
|
137
137
|
Mention something
|
138
138
|
comment.mention!(user)
|
@@ -150,8 +150,8 @@ Mentions?
|
|
150
150
|
Find out if an objects mentions
|
151
151
|
user.mentioned_by?(comment)
|
152
152
|
|
153
|
-
All
|
154
|
-
user.
|
153
|
+
All mentioners
|
154
|
+
user.mentioners(Comment)
|
155
155
|
|
156
156
|
---
|
157
157
|
|
data/demo/demo_app/Gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gem 'rails', '~> 3.2.1'
|
4
|
-
gem 'socialization'
|
4
|
+
gem 'socialization'
|
5
5
|
# Bundle edge Rails instead:
|
6
6
|
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
7
7
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
class CreateMentions < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :mentions do |t|
|
4
|
-
t.string :
|
5
|
-
t.integer :
|
4
|
+
t.string :mentioner_type
|
5
|
+
t.integer :mentioner_id
|
6
6
|
t.string :mentionable_type
|
7
7
|
t.integer :mentionable_id
|
8
8
|
t.datetime :created_at
|
9
9
|
end
|
10
10
|
|
11
|
-
add_index :mentions, ["
|
11
|
+
add_index :mentions, ["mentioner_id", "mentioner_type"], :name => "fk_mentions"
|
12
12
|
add_index :mentions, ["mentionable_id", "mentionable_type"], :name => "fk_mentionables"
|
13
13
|
end
|
14
14
|
end
|
data/demo/demo_app/db/schema.rb
CHANGED
@@ -48,15 +48,15 @@ ActiveRecord::Schema.define(:version => 20120221202703) do
|
|
48
48
|
add_index "likes", ["liker_id", "liker_type"], :name => "fk_likes"
|
49
49
|
|
50
50
|
create_table "mentions", :force => true do |t|
|
51
|
-
t.string "
|
52
|
-
t.integer "
|
51
|
+
t.string "mentioner_type"
|
52
|
+
t.integer "mentioner_id"
|
53
53
|
t.string "mentionable_type"
|
54
54
|
t.integer "mentionable_id"
|
55
55
|
t.datetime "created_at"
|
56
56
|
end
|
57
57
|
|
58
58
|
add_index "mentions", ["mentionable_id", "mentionable_type"], :name => "fk_mentionables"
|
59
|
-
add_index "mentions", ["
|
59
|
+
add_index "mentions", ["mentioner_id", "mentioner_type"], :name => "fk_mentions"
|
60
60
|
|
61
61
|
create_table "movies", :force => true do |t|
|
62
62
|
t.string "name"
|
@@ -1,14 +1,14 @@
|
|
1
1
|
class CreateMentions < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :mentions do |t|
|
4
|
-
t.string :
|
5
|
-
t.integer :
|
4
|
+
t.string :mentioner_type
|
5
|
+
t.integer :mentioner_id
|
6
6
|
t.string :mentionable_type
|
7
7
|
t.integer :mentionable_id
|
8
8
|
t.datetime :created_at
|
9
9
|
end
|
10
10
|
|
11
|
-
add_index :mentions, ["
|
11
|
+
add_index :mentions, ["mentioner_id", "mentioner_type"], :name => "fk_mentions"
|
12
12
|
add_index :mentions, ["mentionable_id", "mentionable_type"], :name => "fk_mentionables"
|
13
13
|
end
|
14
14
|
end
|
@@ -38,6 +38,13 @@ module Socialization
|
|
38
38
|
!self.follows.where(:followable_type => followable.class.to_s, :followable_id => followable.id).empty?
|
39
39
|
end
|
40
40
|
|
41
|
+
def followees(klass)
|
42
|
+
klass = klass.to_s.singularize.camelize.constantize unless klass.is_a?(Class)
|
43
|
+
klass.joins("INNER JOIN follows ON follows.followable_id = #{klass.to_s.tableize}.id AND follows.followable_type = '#{klass.to_s}'").
|
44
|
+
where("follows.follower_type = '#{self.class.to_s}'").
|
45
|
+
where("follows.follower_id = #{self.id}")
|
46
|
+
|
47
|
+
end
|
41
48
|
end
|
42
49
|
end
|
43
50
|
end
|
data/lib/socialization/hello.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'active_support/concern'
|
2
2
|
|
3
|
-
%w{followable follower follow_store likeable liker like_store mentionable
|
3
|
+
%w{followable follower follow_store likeable liker like_store mentionable mentioner mention_store}.each do |f|
|
4
4
|
require "#{File.dirname(__FILE__)}/#{f}"
|
5
5
|
end
|
6
6
|
|
@@ -36,8 +36,8 @@ module Socialization
|
|
36
36
|
end
|
37
37
|
|
38
38
|
## Mention
|
39
|
-
def
|
40
|
-
include Socialization::
|
39
|
+
def acts_as_mentioner(opts = nil)
|
40
|
+
include Socialization::Mentioner
|
41
41
|
end
|
42
42
|
|
43
43
|
def acts_as_mentionable(opts = nil)
|
data/lib/socialization/liker.rb
CHANGED
@@ -38,6 +38,13 @@ module Socialization
|
|
38
38
|
!self.likes.where(:likeable_type => likeable.class.to_s, :likeable_id => likeable.id).empty?
|
39
39
|
end
|
40
40
|
|
41
|
+
def likees(klass)
|
42
|
+
klass = klass.to_s.singularize.camelize.constantize unless klass.is_a?(Class)
|
43
|
+
klass.joins("INNER JOIN likes ON likes.likeable_id = #{klass.to_s.tableize}.id AND likes.likeable_type = '#{klass.to_s}'").
|
44
|
+
where("likes.liker_type = '#{self.class.to_s}'").
|
45
|
+
where("likes.liker_id = #{self.id}")
|
46
|
+
end
|
47
|
+
|
41
48
|
private
|
42
49
|
def ensure_likeable!(likeable)
|
43
50
|
raise ArgumentError, "#{likeable} is not likeable!" unless likeable.is_likeable?
|
@@ -3,10 +3,10 @@ module Socialization
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
included do
|
6
|
-
belongs_to :
|
7
|
-
belongs_to :mentionable,
|
6
|
+
belongs_to :mentioner, :polymorphic => true
|
7
|
+
belongs_to :mentionable, :polymorphic => true
|
8
8
|
|
9
|
-
validates_uniqueness_of :mentionable_type, :scope => [:mentionable_id, :
|
9
|
+
validates_uniqueness_of :mentionable_type, :scope => [:mentionable_id, :mentioner_type, :mentioner_id], :message => 'You cannot mention the same thing twice in a given object.'
|
10
10
|
|
11
11
|
def self.human_attribute_name(*args); ''; end
|
12
12
|
end
|
@@ -12,21 +12,21 @@ module Socialization
|
|
12
12
|
|
13
13
|
included do
|
14
14
|
# A mentioning is the Mention record of describing the mention relationship between
|
15
|
-
# the
|
15
|
+
# the mentioner and the mentionable (self).
|
16
16
|
has_many :mentionings, :as => :mentionable, :dependent => :destroy, :class_name => 'Mention'
|
17
17
|
|
18
18
|
def is_mentionable?
|
19
19
|
true
|
20
20
|
end
|
21
21
|
|
22
|
-
def mentioned_by?(
|
23
|
-
raise ArgumentError, "#{
|
24
|
-
!self.mentionings.where(:
|
22
|
+
def mentioned_by?(mentioner)
|
23
|
+
raise ArgumentError, "#{mentioner} is not a mentioner!" unless mentioner.is_mentioner?
|
24
|
+
!self.mentionings.where(:mentioner_type => mentioner.class.to_s, :mentioner_id => mentioner.id).empty?
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
27
|
+
def mentioners(klass)
|
28
28
|
klass = klass.to_s.singularize.camelize.constantize unless klass.is_a?(Class)
|
29
|
-
klass.joins("INNER JOIN mentions ON mentions.
|
29
|
+
klass.joins("INNER JOIN mentions ON mentions.mentioner_id = #{klass.to_s.tableize}.id AND mentions.mentioner_type = '#{klass.to_s}'").
|
30
30
|
where("mentions.mentionable_type = '#{self.class.to_s}'").
|
31
31
|
where("mentions.mentionable_id = #{self.id}")
|
32
32
|
end
|
@@ -1,30 +1,30 @@
|
|
1
1
|
module ActiveRecord
|
2
2
|
class Base
|
3
|
-
def
|
3
|
+
def is_mentioner?
|
4
4
|
false
|
5
5
|
end
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
9
|
module Socialization
|
10
|
-
module
|
10
|
+
module Mentioner
|
11
11
|
extend ActiveSupport::Concern
|
12
12
|
|
13
13
|
included do
|
14
14
|
# A mention is the Mention record (self) mentionning a mentionable record.
|
15
|
-
has_many :mentions, :as => :
|
15
|
+
has_many :mentions, :as => :mentioner, :dependent => :destroy, :class_name => 'Mention'
|
16
16
|
|
17
|
-
def
|
17
|
+
def is_mentioner?
|
18
18
|
true
|
19
19
|
end
|
20
20
|
|
21
21
|
def mention!(mentionable)
|
22
22
|
ensure_mentionable!(mentionable)
|
23
|
-
Mention.create!({ :
|
23
|
+
Mention.create!({ :mentioner => self, :mentionable => mentionable }, :without_protection => true)
|
24
24
|
end
|
25
25
|
|
26
26
|
def unmention!(mentionable)
|
27
|
-
mm = mentionable.mentionings.where(:
|
27
|
+
mm = mentionable.mentionings.where(:mentioner_type => self.class.to_s, :mentioner_id => self.id)
|
28
28
|
unless mm.empty?
|
29
29
|
mm.each { |m| m.destroy }
|
30
30
|
else
|
@@ -37,6 +37,13 @@ module Socialization
|
|
37
37
|
!self.mentions.where(:mentionable_type => mentionable.class.to_s, :mentionable_id => mentionable.id).empty?
|
38
38
|
end
|
39
39
|
|
40
|
+
def mentionees(klass)
|
41
|
+
klass = klass.to_s.singularize.camelize.constantize unless klass.is_a?(Class)
|
42
|
+
klass.joins("INNER JOIN mentions ON mentions.mentionable_id = #{klass.to_s.tableize}.id AND mentions.mentionable_type = '#{klass.to_s}'").
|
43
|
+
where("mentions.mentioner_type = '#{self.class.to_s}'").
|
44
|
+
where("mentions.mentioner_id = #{self.id}")
|
45
|
+
end
|
46
|
+
|
40
47
|
private
|
41
48
|
def ensure_mentionable!(mentionable)
|
42
49
|
raise ArgumentError, "#{mentionable} is not mentionable!" unless mentionable.is_mentionable?
|
@@ -44,4 +51,4 @@ module Socialization
|
|
44
51
|
|
45
52
|
end
|
46
53
|
end
|
47
|
-
end
|
54
|
+
end
|
data/test/follow_test.rb
CHANGED
@@ -35,6 +35,15 @@ class FollowTest < Test::Unit::TestCase
|
|
35
35
|
@follower1.unfollow!(@followable1)
|
36
36
|
end
|
37
37
|
end
|
38
|
+
|
39
|
+
should "expose a list of its followees" do
|
40
|
+
Follow.create :follower => @follower1, :followable => @followable1
|
41
|
+
assert @follower1.followees(ImAFollowable).is_a?(ActiveRecord::Relation)
|
42
|
+
assert_equal [@followable1], @follower1.followees(ImAFollowable).all
|
43
|
+
|
44
|
+
assert_equal @follower1.followees(ImAFollowable), @follower1.followees(:im_a_followables)
|
45
|
+
assert_equal @follower1.followees(ImAFollowable), @follower1.followees("im_a_followable")
|
46
|
+
end
|
38
47
|
end
|
39
48
|
|
40
49
|
context "a Followable" do
|
@@ -113,4 +122,4 @@ class FollowTest < Test::Unit::TestCase
|
|
113
122
|
@followable1 = ImAFollowable.create
|
114
123
|
@followable2 = ImAFollowable.create
|
115
124
|
end
|
116
|
-
end
|
125
|
+
end
|
data/test/like_test.rb
CHANGED
@@ -35,6 +35,15 @@ class LikeTest < Test::Unit::TestCase
|
|
35
35
|
@liker1.unlike!(@likeable1)
|
36
36
|
end
|
37
37
|
end
|
38
|
+
|
39
|
+
should "expose a list of its likes" do
|
40
|
+
Like.create :liker => @liker1, :likeable => @likeable1
|
41
|
+
assert @liker1.likees(ImALikeable).is_a?(ActiveRecord::Relation)
|
42
|
+
assert_equal [@likeable1], @liker1.likees(ImALikeable).all
|
43
|
+
|
44
|
+
assert_equal @liker1.likees(ImALikeable), @liker1.likees(:im_a_likeables)
|
45
|
+
assert_equal @liker1.likees(ImALikeable), @liker1.likees("im_a_likeable")
|
46
|
+
end
|
38
47
|
end
|
39
48
|
|
40
49
|
context "a Likeable" do
|
data/test/mention_test.rb
CHANGED
@@ -1,43 +1,52 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__))+'/test_helper'
|
2
2
|
|
3
3
|
class MentionTest < Test::Unit::TestCase
|
4
|
-
context "a
|
4
|
+
context "a Mentioner" do
|
5
5
|
setup do
|
6
6
|
seed
|
7
7
|
end
|
8
8
|
|
9
|
-
should "be
|
10
|
-
assert_equal true, @
|
9
|
+
should "be mentioner" do
|
10
|
+
assert_equal true, @mentioner1.is_mentioner?
|
11
11
|
end
|
12
12
|
|
13
13
|
should "be able to mention a Mentionable" do
|
14
|
-
assert @
|
15
|
-
assert_equal true, @
|
16
|
-
assert_equal false, @
|
14
|
+
assert @mentioner1.mention!(@mentionable1)
|
15
|
+
assert_equal true, @mentioner1.mentions?(@mentionable1)
|
16
|
+
assert_equal false, @mentioner2.mentions?(@mentionable1)
|
17
17
|
end
|
18
18
|
|
19
19
|
should "be able to unmention a Mentionable" do
|
20
|
-
Mention.create :
|
21
|
-
assert @
|
22
|
-
assert_equal false, @
|
20
|
+
Mention.create :mentioner => @mentioner1, :mentionable => @mentionable1
|
21
|
+
assert @mentioner1.unmention!(@mentionable1)
|
22
|
+
assert_equal false, @mentioner1.mentions?(@mentionable1)
|
23
23
|
end
|
24
24
|
|
25
25
|
should "not be able to mention the same thing twice" do
|
26
|
-
assert @
|
26
|
+
assert @mentioner1.mention!(@mentionable1)
|
27
27
|
|
28
28
|
assert_raise ActiveRecord::RecordInvalid do
|
29
|
-
@
|
29
|
+
@mentioner1.mention!(@mentionable1)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
should "not be able to unmention something that is not mentionned" do
|
34
34
|
assert_raise ActiveRecord::RecordNotFound do
|
35
|
-
@
|
35
|
+
@mentioner1.unmention!(@mentionable1)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
should "be able to mention itself" do
|
40
|
-
@
|
40
|
+
@mentioner_and_mentionable.mention!(@mentioner_and_mentionable)
|
41
|
+
end
|
42
|
+
|
43
|
+
should "expose a list of its mentionees" do
|
44
|
+
Mention.create :mentioner => @mentioner1, :mentionable => @mentionable1
|
45
|
+
assert @mentioner1.mentionees(ImAMentioner).is_a?(ActiveRecord::Relation)
|
46
|
+
assert_equal [@mentionable1], @mentioner1.mentionees(ImAMentionable).all
|
47
|
+
|
48
|
+
assert_equal @mentioner1.mentionees(ImAMentionable), @mentioner1.mentionees(:im_a_mentionables)
|
49
|
+
assert_equal @mentioner1.mentionees(ImAMentionable), @mentioner1.mentionees("im_a_mentionable")
|
41
50
|
end
|
42
51
|
end
|
43
52
|
|
@@ -51,57 +60,57 @@ class MentionTest < Test::Unit::TestCase
|
|
51
60
|
end
|
52
61
|
|
53
62
|
should "be able to determine who mentions it" do
|
54
|
-
Mention.create :
|
55
|
-
assert_equal true, @mentionable1.mentioned_by?(@
|
56
|
-
assert_equal false, @mentionable1.mentioned_by?(@
|
63
|
+
Mention.create :mentioner => @mentioner1, :mentionable => @mentionable1
|
64
|
+
assert_equal true, @mentionable1.mentioned_by?(@mentioner1)
|
65
|
+
assert_equal false, @mentionable1.mentioned_by?(@mentioner2)
|
57
66
|
end
|
58
67
|
|
59
|
-
should "expose a list of its
|
60
|
-
Mention.create :
|
61
|
-
assert @mentionable1.
|
62
|
-
assert_equal [@
|
68
|
+
should "expose a list of its mentioners" do
|
69
|
+
Mention.create :mentioner => @mentioner1, :mentionable => @mentionable1
|
70
|
+
assert @mentionable1.mentioners(ImAMentioner).is_a?(ActiveRecord::Relation)
|
71
|
+
assert_equal [@mentioner1], @mentionable1.mentioners(ImAMentioner).all
|
63
72
|
|
64
|
-
assert_equal @mentionable1.
|
65
|
-
assert_equal @mentionable1.
|
73
|
+
assert_equal @mentionable1.mentioners(ImAMentioner), @mentionable1.mentioners(:im_a_mentioners)
|
74
|
+
assert_equal @mentionable1.mentioners(ImAMentioner), @mentionable1.mentioners("im_a_mentioner")
|
66
75
|
end
|
67
76
|
|
68
77
|
should "expose mentionings" do
|
69
|
-
Mention.create :
|
78
|
+
Mention.create :mentioner => @mentioner1, :mentionable => @mentionable1
|
70
79
|
mentionings = @mentionable1.mentionings
|
71
80
|
assert_equal 1, mentionings.size
|
72
81
|
assert mentionings.first.is_a?(Mention)
|
73
82
|
end
|
74
83
|
end
|
75
84
|
|
76
|
-
context "Deleting a
|
85
|
+
context "Deleting a mentioner" do
|
77
86
|
setup do
|
78
87
|
seed
|
79
|
-
@
|
88
|
+
@mentioner1.mention!(@mentionable1)
|
80
89
|
end
|
81
90
|
|
82
91
|
should "delete its Mention records" do
|
83
|
-
@
|
84
|
-
assert_equal false, @mentionable1.mentioned_by?(@
|
92
|
+
@mentioner1.destroy
|
93
|
+
assert_equal false, @mentionable1.mentioned_by?(@mentioner1)
|
85
94
|
end
|
86
95
|
end
|
87
96
|
|
88
97
|
context "Deleting a Mentionable" do
|
89
98
|
setup do
|
90
99
|
seed
|
91
|
-
@
|
100
|
+
@mentioner1.mention!(@mentionable1)
|
92
101
|
end
|
93
102
|
|
94
103
|
should "delete its Mention records" do
|
95
104
|
@mentionable1.destroy
|
96
|
-
assert_equal false, @
|
105
|
+
assert_equal false, @mentioner1.mentions?(@mentionable1)
|
97
106
|
end
|
98
107
|
end
|
99
108
|
|
100
109
|
def seed
|
101
|
-
@
|
102
|
-
@
|
110
|
+
@mentioner1 = ImAMentioner.create
|
111
|
+
@mentioner2 = ImAMentioner.create
|
103
112
|
@mentionable1 = ImAMentionable.create
|
104
113
|
@mentionable2 = ImAMentionable.create
|
105
|
-
@
|
114
|
+
@mentioner_and_mentionable = ImAMentionerAndMentionable.create
|
106
115
|
end
|
107
|
-
end
|
116
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -50,8 +50,8 @@ ActiveRecord::Schema.define(:version => 0) do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
create_table :mentions do |t|
|
53
|
-
t.string :
|
54
|
-
t.integer :
|
53
|
+
t.string :mentioner_type
|
54
|
+
t.integer :mentioner_id
|
55
55
|
t.string :mentionable_type
|
56
56
|
t.integer :mentionable_id
|
57
57
|
t.datetime :created_at
|
@@ -73,7 +73,7 @@ ActiveRecord::Schema.define(:version => 0) do
|
|
73
73
|
t.timestamps
|
74
74
|
end
|
75
75
|
|
76
|
-
create_table :
|
76
|
+
create_table :im_a_mentioners do |t|
|
77
77
|
t.timestamps
|
78
78
|
end
|
79
79
|
|
@@ -81,7 +81,7 @@ ActiveRecord::Schema.define(:version => 0) do
|
|
81
81
|
t.timestamps
|
82
82
|
end
|
83
83
|
|
84
|
-
create_table :
|
84
|
+
create_table :im_a_mentioner_and_mentionables do |t|
|
85
85
|
t.timestamps
|
86
86
|
end
|
87
87
|
|
@@ -106,7 +106,7 @@ class User < ActiveRecord::Base
|
|
106
106
|
end
|
107
107
|
|
108
108
|
class Comment < ActiveRecord::Base
|
109
|
-
|
109
|
+
acts_as_mentioner
|
110
110
|
belongs_to :user
|
111
111
|
belongs_to :movie
|
112
112
|
end
|
@@ -144,16 +144,16 @@ class ImALikeable < ActiveRecord::Base
|
|
144
144
|
acts_as_likeable
|
145
145
|
end
|
146
146
|
|
147
|
-
class
|
148
|
-
|
147
|
+
class ImAMentioner < ActiveRecord::Base
|
148
|
+
acts_as_mentioner
|
149
149
|
end
|
150
150
|
|
151
151
|
class ImAMentionable < ActiveRecord::Base
|
152
152
|
acts_as_mentionable
|
153
153
|
end
|
154
154
|
|
155
|
-
class
|
156
|
-
|
155
|
+
class ImAMentionerAndMentionable < ActiveRecord::Base
|
156
|
+
acts_as_mentioner
|
157
157
|
acts_as_mentionable
|
158
158
|
end
|
159
159
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: socialization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
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: 2012-02-
|
12
|
+
date: 2012-02-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
16
|
-
requirement: &
|
16
|
+
requirement: &70105380527140 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70105380527140
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: appraisal
|
27
|
-
requirement: &
|
27
|
+
requirement: &70105380526160 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70105380526160
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: logger
|
38
|
-
requirement: &
|
38
|
+
requirement: &70105380525500 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70105380525500
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: mocha
|
49
|
-
requirement: &
|
49
|
+
requirement: &70105380525080 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70105380525080
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: shoulda
|
60
|
-
requirement: &
|
60
|
+
requirement: &70105380524440 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70105380524440
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: sqlite3
|
71
|
-
requirement: &
|
71
|
+
requirement: &70105380523500 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70105380523500
|
80
80
|
description: Socialization allows any model to Follow and/or Like any other model.
|
81
81
|
This is accomplished through a double polymorphic relationship on the Follow and
|
82
82
|
Like models. But you don't need to know that since all the complexity is hidden
|
@@ -189,7 +189,7 @@ files:
|
|
189
189
|
- lib/socialization/liker.rb
|
190
190
|
- lib/socialization/mention_store.rb
|
191
191
|
- lib/socialization/mentionable.rb
|
192
|
-
- lib/socialization/
|
192
|
+
- lib/socialization/mentioner.rb
|
193
193
|
- lib/socialization/version.rb
|
194
194
|
- socialization.gemspec
|
195
195
|
- test/follow_test.rb
|