activerecord-hackery--ransack/lib/ransack/nodes/bindable.rb

21 lines
349 B
Ruby
Raw Normal View History

module Ransack
module Nodes
module Bindable
attr_accessor :parent, :attr_name
def attr
@attr ||= context.table_for(parent)[attr_name]
end
def klass
@klass ||= context.klassify(parent)
end
def reset_binding!
@parent = @attr_name = @attr = @klass = nil
end
end
end
end