検索機能を実装しようと試みていたのですが、エラーが出て、解決できませんでした。お力を貸して頂けると、大変嬉しいです。よろしくお願いします。
NoMethodError in PostsController#index_two
undefined method `paginate' for #Post::ActiveRecord_Relation:0x00007fb9a6bd19f8
@users = if params[:search]
#searchされた場合は、原文+.where('name LIKE ?', "%#{params[:search]}%")を実行
この行にエラーがあります。➡️ Post.where(activated: true).paginate(title: params[:taitoru]).where('name LIKE ?', "%#{params[:search]}%")
else
#searchされていない場合は、原文そのまま
Post.where(activated: true).paginate(title: params[:taitoru])
どうすれば解決できますでしょうか?よろしくお願い致します。
回答1件
あなたの回答
tips
プレビュー