2012-01-25 08:31:49 +00:00
|
|
|
class ActivityFeed < ActiveRecord::Base
|
2012-01-26 17:04:58 +00:00
|
|
|
|
2014-03-13 21:36:28 +00:00
|
|
|
BUILD = %w(build_list_notification)
|
2012-03-15 17:52:54 +00:00
|
|
|
|
|
|
|
belongs_to :user
|
2015-05-05 13:25:29 +01:00
|
|
|
belongs_to :creator, class_name: 'User'
|
|
|
|
serialize :data
|
2012-01-26 17:04:58 +00:00
|
|
|
|
2014-03-11 07:39:25 +00:00
|
|
|
default_scope { order created_at: :desc }
|
2015-05-05 15:09:23 +01:00
|
|
|
scope :outdated, -> { offset(1000) }
|
2015-05-05 13:25:29 +01:00
|
|
|
scope :by_project_name, ->(name) { where(project_name: name) if name.present? }
|
|
|
|
scope :by_owner_uname, ->(owner) { where(project_owner: owner) if owner.present? }
|
2012-03-15 17:52:54 +00:00
|
|
|
|
2015-05-05 13:25:29 +01:00
|
|
|
self.per_page = 20
|
2012-03-15 17:52:54 +00:00
|
|
|
|
2012-01-26 17:04:58 +00:00
|
|
|
def partial
|
2015-05-05 13:25:29 +01:00
|
|
|
"home/partials/#{self.kind}"
|
2012-01-26 17:04:58 +00:00
|
|
|
end
|
2012-01-25 08:31:49 +00:00
|
|
|
end
|