Class: Activity
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Activity
- Defined in:
- lib/activity_tracker/activity.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.by(user) ⇒ Object
30 31 32 |
# File 'lib/activity_tracker/activity.rb', line 30 def self.by(user) Activity.where("user_id = ?", user.id).count end |
Instance Method Details
#can_be_deleted_by?(user) ⇒ Boolean
34 35 36 37 38 |
# File 'lib/activity_tracker/activity.rb', line 34 def can_be_deleted_by?(user) return false if user.nil? return false unless user.admin? || user.moderator? || self.user_id.eql?(user.id) true end |