Differences Between Includes and Joins in Ruby on Rails

Written by ashubhosale | Published 2021/06/07
Tech Story Tags: ruby-on-rails | activerecord | refactoring | ruby | programming | coding | development | code | hackernoon-es

TLDR Many of us know about includes, joins but sometimes we confuse about their usage. As I was experimenting with code refactoring in one of my projects, there I have tried these things. As we know includes and join are used when we are performing operations on associated tables. Both are used for the same purpose. When we want to fetch data along with an associated table then includes must be used.Joins: Uses lazy loading. Includes: Uses eager loading, When. We can use joins when we. want to consider the data as a condition from the joined table.via the TL;DR App

no story

Written by ashubhosale | I am here to write about my experiences and how I learnt from my experiences.
Published by HackerNoon on 2021/06/07