Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ end

## Customizations

- Ransack options can be customized defining a `ransack_options` method in the controller, example:
- Ransack options can be changed defining a method `ransack_options` in the resource controller
- The Ransack results by default use _distinct_, to change this behavior it is possible to define a `ransack_result_distinct` method
- When a search term is not recognized a flash alert is shown (using a value from locales at `administrate_ransack.errors.invalid_search`), a custom behavior can be apply defining a method `invalid_search_callback`

```rb
module Admin
Expand All @@ -127,6 +129,15 @@ module Admin
# raises an exception on unknown parameters
{ ignore_unknown_conditions: false }
end

def ransack_result_distinct
# disable distinct
false
end

def invalid_search_callback(e)
raise e
end
end
end
```
Expand Down
2 changes: 1 addition & 1 deletion lib/administrate_ransack/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module AdministrateRansack
VERSION = '0.6.0'
VERSION = '0.7.0'
end