lib/rasti/db/relations/many_to_one.rb in rasti-db-2.3.3 vs lib/rasti/db/relations/many_to_one.rb in rasti-db-3.0.0

- old
+ new

@@ -15,21 +15,21 @@ query = target_collection.where(source_collection_class.primary_key => fks) query = query.exclude_attributes(*excluded_attributes) if excluded_attributes query = query.select_attributes(*selected_attributes) if selected_attributes query = relations_graph.apply_to query if relations_graph - relation_rows = query.each_with_object({}) do |row, hash| + relation_rows = query.each_with_object({}) do |row, hash| hash[row.public_send(source_collection_class.primary_key)] = row end - - rows.each do |row| + + rows.each do |row| row[name] = relation_rows[row[foreign_key]] end end def add_join(environment, dataset, prefix=nil) validate_join! - + relation_alias = join_relation_name prefix relation_name = prefix ? Sequel[prefix] : Sequel[source_collection_class.collection_name] relation_condition = { \ No newline at end of file