Memo
rails ActiveRecord テーブル結合
Home
›
Memo
›
ActiveRecord テーブル結合
本稿について
本稿はサイト運営者が学んだことなどを記したメモの内容です。
全てが正確な情報とは限りません。ご注意ください。また修正するべき点は適時修正していきます
内部結合
data = TableA.joins(:table_b).where(table_b: { data: 1 })
内部結合+検索
scope :where_contents, lambda {
table = joins(:category)
table.where.not(categories: { id: ID, code: ‘code' })
.or(table.where(categories: { code: nil }))
}
関連ページ
faviconの設定
#rails
2020-05-11 11:50:18
sidekiq / active job
#rails
2020-11-13 21:09:51
Adsenseを導入した時
#rails
2020-05-06 12:27:07
Time Zoneの設定
#rails
2020-09-22 11:39:46
Rspec テスト実行前にseedを実行する
#rails
2020-06-12 20:34:06
Back