module Ransack::Nodes::Bindable

Attributes

attr_name[RW]
parent[RW]

Public Instance Methods

arel_attribute()
Alias for: attr
attr() click to toggle source
# File lib/ransack/nodes/bindable.rb, line 7
def attr
  @attr ||= get_arel_attribute
end
Also aliased as: arel_attribute
bound?() click to toggle source
# File lib/ransack/nodes/bindable.rb, line 20
def bound?
  attr_name.present? && parent.present?
end
klass() click to toggle source
# File lib/ransack/nodes/bindable.rb, line 16
def klass
  @klass ||= context.klassify(parent)
end
ransacker() click to toggle source
# File lib/ransack/nodes/bindable.rb, line 12
def ransacker
  klass._ransackers[attr_name]
end
reset_binding!() click to toggle source
# File lib/ransack/nodes/bindable.rb, line 24
def reset_binding!
  @parent = @attr_name = @attr = @klass = nil
end

Private Instance Methods

get_arel_attribute() click to toggle source
# File lib/ransack/nodes/bindable.rb, line 30
def get_arel_attribute
  if ransacker
    ransacker.attr_from(self)
  else
    get_attribute
  end
end
get_attribute() click to toggle source
# File lib/ransack/nodes/bindable.rb, line 38
def get_attribute
  if is_alias_attribute?
    context.table_for(parent)[parent.base_klass.attribute_aliases[attr_name]]
  else
    context.table_for(parent)[attr_name]
  end
end
is_alias_attribute?() click to toggle source
# File lib/ransack/nodes/bindable.rb, line 46
def is_alias_attribute?
  Ransack::SUPPORTS_ATTRIBUTE_ALIAS &&
  parent.base_klass.attribute_aliases.key?(attr_name)
end