Skip to content

Commit d0bc702

Browse files
authored
Merge pull request #45 from blocknotes/bump-to-0.7.0
Bump to version 0.7.0
2 parents fb2eefb + a0f078e commit d0bc702

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ end
116116

117117
## Customizations
118118

119-
- Ransack options can be customized defining a `ransack_options` method in the controller, example:
119+
- Ransack options can be changed defining a method `ransack_options` in the resource controller
120+
- The Ransack results by default use _distinct_, to change this behavior it is possible to define a `ransack_result_distinct` method
121+
- 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`
120122

121123
```rb
122124
module Admin
@@ -127,6 +129,15 @@ module Admin
127129
# raises an exception on unknown parameters
128130
{ ignore_unknown_conditions: false }
129131
end
132+
133+
def ransack_result_distinct
134+
# disable distinct
135+
false
136+
end
137+
138+
def invalid_search_callback(e)
139+
raise e
140+
end
130141
end
131142
end
132143
```
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module AdministrateRansack
4-
VERSION = '0.6.0'
4+
VERSION = '0.7.0'
55
end

0 commit comments

Comments
 (0)