6
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ransackでsearchメソッドは非推奨な件について

Last updated at Posted at 2018-12-10

検索機能のgem ransackでこんなことが起きたのでメモとして残しておきます。

$ rails s
.
.
.
DEPRECATION WARNING: #search is deprecated and will be removed in 2.3 
.
.
.

なんかDEPRECATION WARNING(非推奨的なエラー)がおきてました。。。capybaraなどでテスト通すとめちゃくちゃwarning出てきてうざいです🤔
公式の文言にもありますが以下の通りです。ransack

Ransack #search method
Ransack will try to make the class method #search available in your models, but if #search has already been defined elsewhere, you can always use the default #ransack class method. So the following are equivalent:
Article.ransack(params[:q])
Article.search(params[:q])
Users have reported issues of #search name conflicts with other gems, so the #search method alias will be deprecated in the next major version of Ransack (2.0). It's advisable to use the default #ransack instead.

searchメソッドは廃止予定なんですね、やらかしてました。代わりにransackメソッド使えとのことなので対応したら警告でなくなりました。よかったです。

6
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?