Module: Ransack::Nodes::Bindable

Included in:
Attribute, Sort
Defined in:
lib/ransack/nodes/bindable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attr_nameObject

Returns the value of attribute attr_name.



5
6
7
# File 'lib/ransack/nodes/bindable.rb', line 5

def attr_name
  @attr_name
end

#parentObject

Returns the value of attribute parent.



5
6
7
# File 'lib/ransack/nodes/bindable.rb', line 5

def parent
  @parent
end

Instance Method Details

#attrObject Also known as: arel_attribute



7
8
9
# File 'lib/ransack/nodes/bindable.rb', line 7

def attr
  @attr ||= ransacker ? ransacker.attr_from(self) : context.table_for(parent)[attr_name]
end

#bound?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/ransack/nodes/bindable.rb', line 20

def bound?
  attr_name.present? && parent.present?
end

#klassObject



16
17
18
# File 'lib/ransack/nodes/bindable.rb', line 16

def klass
  @klass ||= context.klassify(parent)
end

#ransackerObject



12
13
14
# File 'lib/ransack/nodes/bindable.rb', line 12

def ransacker
  klass._ransackers[attr_name]
end

#reset_binding!Object



24
25
26
# File 'lib/ransack/nodes/bindable.rb', line 24

def reset_binding!
  @parent = @attr_name = @attr = @klass = nil
end