administrate_ransack
administrate_ransack copied to clipboard
refactor: make Ransack distinct optional
Relates to https://github.com/blocknotes/administrate_ransack/issues/28
@blocknotes I believe ransack_result_distinct should be a private or protected method, so it should work correctly even when it is a private method. The same applies to ransack_options, which was added previously. What do you think?
def scoped_resource
options = respond_to?(:ransack_options, true) ? ransack_options : {}
distinct = respond_to?(:ransack_result_distinct, true) ? ransack_result_distinct : true
...
end
private def ransack_options; end
private def ransack_result_distinct; end