Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cleaning-portalmec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Fernando Heise Ferreira
cleaning-portalmec
Commits
a798e533
Commit
a798e533
authored
8 years ago
by
Marcela Ribeiro de Oliveira
Browse files
Options
Downloads
Patches
Plain Diff
add Complainable concern in User, Collection, Reaview and LearningObject models
parent
f8b29939
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/models/collection.rb
+2
-1
2 additions, 1 deletion
app/models/collection.rb
app/models/review.rb
+1
-1
1 addition, 1 deletion
app/models/review.rb
app/models/user.rb
+1
-0
1 addition, 0 deletions
app/models/user.rb
with
4 additions
and
2 deletions
app/models/collection.rb
+
2
−
1
View file @
a798e533
...
...
@@ -31,6 +31,7 @@ class Collection < ApplicationRecord
include
Taggable
include
Trackable
include
Highlights
include
Complainable
has_many
:collection_items
,
as: :collectionable
,
dependent: :destroy
has_many
:collections
,
through: :collection_items
,
source: :collectionable
,
source_type:
'Collection'
...
...
@@ -80,7 +81,7 @@ class Collection < ApplicationRecord
order:
item
[
:order
])}
CollectionItem
.
import
collection_items
,
on_duplicate_key_update:
{
conflict_target:
[
:collection_id
,
:collectionable_id
,
:collectionable_type
],
columns:
[
:order
]}
end
## score methods
def
user_category
owner
.
try
(
'user_category'
)
...
...
This diff is collapsed.
Click to expand it.
app/models/review.rb
+
1
−
1
View file @
a798e533
...
...
@@ -18,6 +18,7 @@
class
Review
<
ApplicationRecord
# *current_user* review *reviewable*
include
Trackable
include
Complainable
belongs_to
:reviewable
,
polymorphic:
true
belongs_to
:user
...
...
@@ -25,7 +26,6 @@ class Review < ApplicationRecord
has_many
:review_ratings
has_many
:ratings
,
through: :review_ratings
has_many
:rates
has_many
:complaints
,
as: :complaintable
validates_presence_of
:user
,
:reviewable
validates_inclusion_of
:reviewable_type
,
in:
%w(LearningObject Collection)
,
message:
'Only LearningObjects and Collections are reviewable.'
...
...
This diff is collapsed.
Click to expand it.
app/models/user.rb
+
1
−
0
View file @
a798e533
...
...
@@ -37,6 +37,7 @@ class User < ApplicationRecord
include
Followable
include
Reputationable
include
Tagger
include
Complainable
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment