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



18
19
20
# File 'app/models/tagging.rb', line 18

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

.tagged_class(taggable) ⇒ Object



11
12
13
14
15
16
# File 'app/models/tagging.rb', line 11

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