Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cs_comments_service
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
cs_comments_service
Commits
29cd6905
Commit
29cd6905
authored
Jul 16, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
still working
parent
0ce290be
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
6 deletions
+5
-6
models/comment_thread.rb
+1
-1
models/commentable.rb
+1
-1
models/subscription.rb
+2
-3
models/user.rb
+1
-1
No files found.
models/comment_thread.rb
View file @
29cd6905
...
@@ -29,7 +29,7 @@ class CommentThread
...
@@ -29,7 +29,7 @@ class CommentThread
end
end
def
subscribers
def
subscribers
subscriptions
.
map
{
|
s
|
User
.
find
(
s
.
subscriber_id
)}
subscriptions
.
map
(
&
:subscriber
)
end
end
def
to_hash
(
params
=
{})
def
to_hash
(
params
=
{})
...
...
models/commentable.rb
View file @
29cd6905
...
@@ -20,7 +20,7 @@ class Commentable
...
@@ -20,7 +20,7 @@ class Commentable
end
end
def
subscribers
def
subscribers
subscriptions
.
map
{
|
s
|
User
.
find
(
s
.
subscriber_id
)}
subscriptions
.
map
(
&
:subscriber
)
end
end
def
to_hash
(
params
=
{})
def
to_hash
(
params
=
{})
...
...
models/subscription.rb
View file @
29cd6905
...
@@ -2,9 +2,8 @@ class Subscription
...
@@ -2,9 +2,8 @@ class Subscription
include
Mongoid
::
Document
include
Mongoid
::
Document
include
Mongoid
::
Timestamps
include
Mongoid
::
Timestamps
field
:subscriber_id
,
type:
String
belongs_to
:subscriber
,
class_name:
"User"
,
autosave:
true
field
:source_id
,
type:
String
belongs_to
:source
,
polymorphic:
true
,
autosave:
true
field
:source_type
,
type:
String
index
[[
:subscriber_id
,
Mongo
::
ASCENDING
],
[
:source_id
,
Mongo
::
ASCENDING
],
[
:source_type
,
Mongo
::
ASCENDING
]]
index
[[
:subscriber_id
,
Mongo
::
ASCENDING
],
[
:source_id
,
Mongo
::
ASCENDING
],
[
:source_type
,
Mongo
::
ASCENDING
]]
index
[[
:source_id
,
Mongo
::
ASCENDING
],
[
:source_type
,
Mongo
::
ASCENDING
]]
index
[[
:source_id
,
Mongo
::
ASCENDING
],
[
:source_type
,
Mongo
::
ASCENDING
]]
...
...
models/user.rb
View file @
29cd6905
...
@@ -25,7 +25,7 @@ class User
...
@@ -25,7 +25,7 @@ class User
end
end
def
followers
def
followers
follower_subscriptions
.
map
{
|
s
|
User
.
find
(
s
.
subscriber_id
)}
follower_subscriptions
.
map
(
&
:subscriber
)
end
end
def
subscribe
(
source
)
def
subscribe
(
source
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment