class Ransack::Nodes::Attribute

Attributes

name[R]
ransacker_args[R]

Public Class Methods

new(context, name = nil, ransacker_args = []) click to toggle source
Calls superclass method
# File lib/ransack/nodes/attribute.rb, line 11
def initialize(context, name = nil, ransacker_args = [])
  super(context)
  self.name = name unless name.blank?
  @ransacker_args = ransacker_args
end

Public Instance Methods

==(other)
Alias for: eql?
eql?(other) click to toggle source
# File lib/ransack/nodes/attribute.rb, line 36
def eql?(other)
  self.class == other.class &&
  self.name == other.name
end
Also aliased as: ==
hash() click to toggle source
# File lib/ransack/nodes/attribute.rb, line 42
def hash
  self.name.hash
end
inspect() click to toggle source
# File lib/ransack/nodes/attribute.rb, line 50
def inspect
  "Attribute <#{name}>"
end
name=(name) click to toggle source
# File lib/ransack/nodes/attribute.rb, line 17
def name=(name)
  @name = name
  context.bind(self, name) unless name.blank?
end
persisted?() click to toggle source
# File lib/ransack/nodes/attribute.rb, line 46
def persisted?
  false
end
type() click to toggle source
# File lib/ransack/nodes/attribute.rb, line 28
def type
  if ransacker
    return ransacker.type
  else
    context.type_for(self)
  end
end
valid?() click to toggle source
# File lib/ransack/nodes/attribute.rb, line 22
def valid?
  bound? && attr &&
  context.klassify(parent).ransackable_attributes(context.auth_object)
  .include?(attr_name.split('.').last)
end