Class: Ransack::Nodes::Condition

Inherits:
Object
  • Object
show all
Defined in:
lib/ransack_abbreviator/ransack_extensions/nodes/condition.rb

Instance Method Summary collapse

Instance Method Details

#build(params) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ransack_abbreviator/ransack_extensions/nodes/condition.rb', line 6

def build(params)
  attrs = params[:a]
  unless attrs.blank?
    case attrs
    when Array
      attrs.each_with_index do |attr, i|
        params[:a][i] = @context.decode_parameter(attr)
      end
    when Hash
      attrs.each do |index, attr|
        params[:a][index][:name] = @context.decode_parameter(attr[:name])
      end
    end
  end
  ransack_condition_build(params)
end

#ransack_condition_buildObject



4
# File 'lib/ransack_abbreviator/ransack_extensions/nodes/condition.rb', line 4

alias_method :ransack_condition_build, :build