0
ユーザーの検索機能が1つしかないので、うまくいきました。次のテキストにページ番号を付け加えよう:
しかし、私はゲームテーブルにページネーションを追加したいが、ゲームのための5つの検索機能があるので、それを実装する方法がわからない。私は次のコントローラーメソッドにページネーションを追加する方法について私は不思議に思っていました。
def index
@games = Game.gamsearch(params[:gamsearch])
@games = Game.consearch(params[:consearch]) if params[:consearch].present?
@games = Game.gensearch(params[:gensearch]) if params[:gensearch].present?
@games = Game.where("game_name LIKE ?", "#{params[:game_name]}%") if params[:game_name].present?
@games = Game.where("console = ?", params[:console]) if params[:console].present?
end
私はスコープを使用してみましたが、既に定義されているにもかかわらず、定義されていないメソッドをページングすることを続けました。 – user1222136