Sha256: c877f7a4f4702ffdf39bc7a6f4ab39de71835853b69ad653d8c61cb3e0ecd6a1
Contents?: true
Size: 796 Bytes
Versions: 1
Compression:
Stored size: 796 Bytes
Contents
class SimilarityTable < EnumerateIt::Base associate_values :unico_neighborhoods, :unico_streets, :unico_street_types, :unico_cities, :unico_people 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 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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unico-training-7.8.0 | app/enumerations/similarity_table.rb |