SQL question You have given two table users and address and a user has many addresses, writes its association and SQL query then writes ORM query.
Anonymous
Ans: there has_many relationships between the two. User < ApplicationRecord has_many :address, class_name: "Address", foreign_key: :user_id, dependent: :destroy end Address < ApplicationRecord belongs_to :user end SQL: Select address* from users left_join addresses where user.id = address.user_id. ORM: User.include(:address).
Check out your Company Bowl for anonymous work chats.