joins vs includes rails code example
Example 1: rails how to use joins
User.joins(:groups).where(groups: {id: 1})
Example 2: joins vs includes
# include is a larger SQL query than joins, loading all
# attributes from other tables into memory
User.joins(:groups).where(groups: {id: 1})
# include is a larger SQL query than joins, loading all
# attributes from other tables into memory