2017-11-28から1日間の記事一覧

【Rails】where like検索の使い方メモ

今回やりたかったことはjoin先のテーブルからLIKE検索したかった。今回使うモデルは2つで以下の形。 class Category < ApplicationRecord has_many :movies end class Movie < ApplicationRecord belongs_to :category endこんな感じでできた Movie.joins(:c…