Module: ActiveManageable::Search::Ransack

Extended by:
ActiveSupport::Concern
Defined in:
lib/active_manageable/search/ransack.rb

Instance Method Summary collapse

Instance Method Details

#initialize_ransack_stateObject



16
17
18
# File 'lib/active_manageable/search/ransack.rb', line 16

def initialize_ransack_state
  @ransack = nil
end

#order(attributes) ⇒ Object

Perform standard index module ordering when no ransack search params provided or no ransack sorts params provided



27
28
29
30
31
32
33
# File 'lib/active_manageable/search/ransack.rb', line 27

def order(attributes)
  if @ransack.blank? || @ransack.sorts.empty?
    @target = @target.order(order_attributes(attributes))
  else
    @target
  end
end

#search(opts) ⇒ Object



20
21
22
23
# File 'lib/active_manageable/search/ransack.rb', line 20

def search(opts)
  @ransack = @target.ransack(opts)
  @target = @ransack.result
end