Skip to content
Snippets Groups Projects
Commit a798e533 authored by Marcela Ribeiro de Oliveira's avatar Marcela Ribeiro de Oliveira
Browse files

add Complainable concern in User, Collection, Reaview and LearningObject models

parent f8b29939
No related branches found
No related tags found
No related merge requests found
......@@ -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')
......
......@@ -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.'
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment