diff --git a/README.md b/README.md index 040b5c7..28596b4 100644 --- a/README.md +++ b/README.md @@ -229,13 +229,24 @@ construct much more complex search forms, such as the one on the Ransack will try to to make `#search` available in your models, but in the case that `#search` has already been defined, you can use `#ransack` instead. For -example the following would be equivalent: +example, the following would be equivalent: ```ruby Article.search(params[:q]) Article.ransack(params[:q]) ``` +If Ransack's `#search` method conflicts with the name of another method named +`search` in your code or another gem, it may be resolved either by patching +the `extended` class_method in `Ransack::Adapters::ActiveRecord::Base` to +remove the line `alias :search :ransack unless base.respond_to? :search`, or by +placing the following line in your Ransack initializer file at +`config/initializers/ransack.rb`: + +```ruby +Ransack::Adapters::ActiveRecord::Base.class_eval('remove_method :search') +``` + ### Associations You can easily use Ransack to search for objects in `has_many` and `belongs_to`