scopeを作成してクエリしていたらタイトルのエラーが発生

よくコードを確認してみたら、joinsjoin と記載してしまっていました

typoには気をつけるように

# だめ
scope :deliverd_this_month, -> {
    join(:histories).where(histories: { created_at: Time.current.beginning_of_month..Time.current.end_of_month })
  }

# ok
scope :deliverd_this_month, -> {
    joins(:histories).where(histories: { created_at: Time.current.beginning_of_month..Time.current.end_of_month })
  }

参考記事

なし

コメントをどうぞ

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

CAPTCHA