administrate_ransack icon indicating copy to clipboard operation
administrate_ransack copied to clipboard

refactor: make Ransack distinct optional

Open blocknotes opened this issue 1 year ago • 1 comments

Relates to https://github.com/blocknotes/administrate_ransack/issues/28

blocknotes avatar Jul 07 '24 20:07 blocknotes

@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

goosys avatar Jul 30 '24 12:07 goosys