Skip to content

raganhan/rails_query_weirdness

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to Rails

This project is to illustrate some weird duplications that can happen when using ‘joins`. These duplications happen when you do a join without selecting something from the joined association. When this happens rails execute a query similar to

“‘ SELECT parents.* FROM parents INNER JOIN children ON children.parent_id = parents.id “`

This will return duplicated ‘parents` rows and rails has no extra information on how to group them while instantiating the `Parent` objects

run the ‘test/unit/parent_test.rb` tests and look at the SQL for details and some ways to work around this issue

About

Some weird query examples using joins

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published