Module: Mongo::Followable::History

Extended by:
ActiveSupport::Concern
Defined in:
lib/mongo_followable/features/history.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#clear_follow_history!Object



36
37
38
# File 'lib/mongo_followable/features/history.rb', line 36

def clear_follow_history!
  self.update_attribute(:follow_history, []) if has_follow_history?
end

#clear_followed_histroy!Object



40
41
42
# File 'lib/mongo_followable/features/history.rb', line 40

def clear_followed_histroy!
  self.update_attribute(:followed_history, []) if has_followed_history?
end

#clear_history!Object



31
32
33
34
# File 'lib/mongo_followable/features/history.rb', line 31

def clear_history!
  clear_follow_history!
  clear_followed_histroy!
end

#ever_followObject



44
45
46
# File 'lib/mongo_followable/features/history.rb', line 44

def ever_follow
  rebuild(self.follow_history) if has_follow_history?
end

#ever_follow?(model) ⇒ Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/mongo_followable/features/history.rb', line 52

def ever_follow?(model)
  self.follow_history.include?(model.class.name + "_" + model.id.to_s) if has_follow_history?
end

#ever_followedObject



48
49
50
# File 'lib/mongo_followable/features/history.rb', line 48

def ever_followed
  rebuild(self.followed_history) if has_followed_history?
end

#ever_followed?(model) ⇒ Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/mongo_followable/features/history.rb', line 56

def ever_followed?(model)
  self.followed_history.include?(model.class.name + "_" + model.id.to_s) if has_followed_history?
end