Method: Ballot::ActiveRecord.type_name

Defined in:
lib/ballot/active_record.rb

.type_name(model) ⇒ Object

Respond with the canonical name for this model. Will be the root class if an STI model.



70
71
72
73
74
# File 'lib/ballot/active_record.rb', line 70

def type_name(model)
  return model if model.kind_of?(String)
  model = model.class if model.kind_of?(::ActiveRecord::Base)
  model.base_class.name
end