Class: Tagging

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
app/models/tagging.rb

Class Method Summary collapse

Class Method Details

.find_taggable(tagged_class, tagged_id) ⇒ Object



20
21
22
# File 'app/models/tagging.rb', line 20

def self.find_taggable(tagged_class, tagged_id)
  tagged_class.constantize.find(tagged_id)
end

.tagged_class(taggable) ⇒ Object



13
14
15
16
17
18
# File 'app/models/tagging.rb', line 13

def self.tagged_class(taggable)
  ActiveRecord::Base.send(
    :class_of_active_record_descendant,
    taggable.class
  ).to_s
end