Skip to content
Snippets Groups Projects
Commit 3b9b2e32 authored by Mauricio Giacomini Girardello's avatar Mauricio Giacomini Girardello
Browse files

adding trackable comments

parent 029460b8
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,8 @@
#
class Bookmark < ActiveRecord::Base
# Example of Trackable:
# *current_user* create bookmark *bookmarkable*
include Trackable
belongs_to :user, counter_cache: true
......
......@@ -12,8 +12,10 @@
#
class CollectionItem < ActiveRecord::Base
belongs_to :collection
# *current_user* add item *collectionable* to *collection*
include Trackable
belongs_to :collection
belongs_to :collectionable, polymorphic: true
validates_presence_of :collection, :collectionable
......
class CollectionsGroup
attr_accessor :title, :collections
def initialize(params={})
@title = params[:title] || nil
@collections = params[:collections] || []
end
end
......@@ -13,6 +13,7 @@
#
class Complaint < ActiveRecord::Base
# *current_user* create complaint about *complaint_reason* for *complaintable*
include Trackable
belongs_to :complaint_reason
......
......@@ -9,6 +9,10 @@
#
class ComplaintReason < ActiveRecord::Base
# *current_user* create complaint reason
# Only admins can create complaint reasons
include Trackable
has_many :complaints
validates_presence_of :reason
......
......@@ -11,6 +11,7 @@
#
class Download < ActiveRecord::Base
# *current_user* download *downloadable*
include Trackable
belongs_to :downloadable, polymorphic: true, counter_cache: true
......
......@@ -11,6 +11,7 @@
#
class Follow < ActiveRecord::Base
# *current_user* follows *followable*
include Trackable
belongs_to :followable, polymorphic: true, counter_cache: true
......
......@@ -14,10 +14,14 @@
class Institution < ActiveRecord::Base
include Tagger
# *current_user* add member for instituion *name*
# *current_user* create instituion
# *current_user* destroy instituion
# *current_user* update instituion
include Trackable
has_and_belongs_to_many :users
has_many :learning_objects, as: :publisher
has_many :collections, as: :owner
......
......@@ -38,6 +38,10 @@ class LearningObject < ActiveRecord::Base
include Scoreable
include Thumbnailable
include Taggable
# *current_user* create learning object
# *current_user* update learning object
# *current_user* destroy learning object
include Trackable
has_many :collection_items, as: :collectionable
......
......@@ -11,6 +11,8 @@
#
class Like < ActiveRecord::Base
# *current_user* likes *likeable*
# *current_user* unlikes *likeable*
include Trackable
belongs_to :likeable, polymorphic: true, counter_cache: true
......
......@@ -9,6 +9,7 @@
# created_at :datetime not null
# updated_at :datetime not null
class Rate < ActiveRecord::Base
# *current_user* rate a review *review*
include Trackable
belongs_to :user
......
......@@ -16,6 +16,7 @@
#
class Review < ActiveRecord::Base
# *current_user* review *reviewable*
include Trackable
belongs_to :reviewable, polymorphic: true
......
class Search
include ActiveModel::Model
# *current_user* search by *query*
include Trackable
attr_accessor :page, :results_per_page, :order, :query, :search_class, :tags, :types, :sources
validates_presence_of :query, :results_per_page, :order, :search_class
......
......@@ -11,6 +11,7 @@
#
class Share < ActiveRecord::Base
# *current_user* shares *shareable*
include Trackable
belongs_to :shareable, polymorphic: true, counter_cache: true
......
class Tagging < ActiveRecord::Base
# *current_user* tag *taggable* with *tag*
include Trackable
belongs_to :tagger, polymorphic: true
......
......@@ -11,6 +11,9 @@
#
class View < ActiveRecord::Base
# *current_user* views *viewable*
include Trackable
belongs_to :viewable, polymorphic: true, counter_cache: true
belongs_to :user
......
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