Sha256: 0d6971d544f5f0e030539c8032bfbaa6a6d2b5538ab088bfb62404d1896ce72e

Contents?: true

Size: 585 Bytes

Versions: 9

Compression:

Stored size: 585 Bytes

Contents

module Ransack
  module Nodes
    module Bindable

      attr_accessor :parent, :attr_name

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

      def ransacker
        klass._ransackers[attr_name]
      end

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

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

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

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ransack-1.5.1 lib/ransack/nodes/bindable.rb
ransack-1.5.0 lib/ransack/nodes/bindable.rb
ransack-1.4.1 lib/ransack/nodes/bindable.rb
ransack-1.4.0 lib/ransack/nodes/bindable.rb
ransack-1.3.0 lib/ransack/nodes/bindable.rb
ransack-1.2.3 lib/ransack/nodes/bindable.rb
ransack-1.2.2 lib/ransack/nodes/bindable.rb
ransack-1.2.1 lib/ransack/nodes/bindable.rb
ransack-1.2.0 lib/ransack/nodes/bindable.rb