module ActsAsAble::Viewable::InstanceMethods
Public Instance Methods
view_count()
click to toggle source
# File lib/acts_as_able/viewable.rb, line 18 def view_count self.viewers.count end
viewers_by_type(viewer_type, options = {})
click to toggle source
# File lib/acts_as_able/viewable.rb, line 22 def viewers_by_type(viewer_type, options = {}) ids = View. where('viewable_id' => self.id, 'viewable_type' => class_name(self), 'viewer_type' => viewer_type.name ).pluck('viewer_id') return viewer_type.where("id in (?)", ids) end