Class: SimilarityTable
- Inherits:
-
EnumerateIt::Base
- Object
- EnumerateIt::Base
- SimilarityTable
- Defined in:
- app/enumerations/similarity_table.rb
Class Method Summary collapse
Class Method Details
.columns(table) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/enumerations/similarity_table.rb', line 4 def self.columns(table) columns = case table when 'unico_street_types' then %w(name) when 'unico_neighborhoods' then %w(name city_id) when 'unico_cities' then %w(name state_id) when 'unico_streets' then %w(name city_id street_type_id) when 'unico_people' then %w(name cpf_cnpj) else [] end columns.map { |x| [translate_column(table, x), x] } end |
.translate_column(table, name) ⇒ Object
17 18 19 20 21 22 |
# File 'app/enumerations/similarity_table.rb', line 17 def self.translate_column(table, name) return if name.blank? model = table.split('_')[1..10].join('_').classify.constantize model.human_attribute_name(name.gsub('_id', '')) end |