Sha256: 38a3df2f1cb2fc232631aa242395294bfb51cf4e82c05c8a88736a87ed20231f
Contents?: true
Size: 1.01 KB
Versions: 156
Compression:
Stored size: 1.01 KB
Contents
module ForestLiana module QueryHelper def self.get_one_associations(resource) SchemaUtils.one_associations(resource) .select { |association| SchemaUtils.model_included?(association.klass) } end def self.get_one_association_names_symbol(resource) self.get_one_associations(resource).map(&:name) end def self.get_one_association_names_string(resource) self.get_one_associations(resource).map { |association| association.name.to_s } end def self.get_tables_associated_to_relations_name(resource) tables_associated_to_relations_name = {} associations_has_one = self.get_one_associations(resource) associations_has_one.each do |association| if tables_associated_to_relations_name[association.table_name].nil? tables_associated_to_relations_name[association.table_name] = [] end tables_associated_to_relations_name[association.table_name] << association.name end tables_associated_to_relations_name end end end
Version data entries
156 entries across 156 versions & 1 rubygems