Sha256: a9eac3402c87aeeed58599b6ae833c040946bebc47903a0a614351db0b74d268

Contents?: true

Size: 706 Bytes

Versions: 12

Compression:

Stored size: 706 Bytes

Contents

module Ransack
  module Nodes
    module Bindable

      attr_accessor :parent, :attr_name

      def attr
        @attr ||= get_arel_attribute
      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

      private

        def get_arel_attribute
          if ransacker
            ransacker.attr_from(self)
          else
            context.table_for(parent)[attr_name]
          end
        end

    end
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
ransack-1.7.0 lib/ransack/nodes/bindable.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/ransack-1.6.6/lib/ransack/nodes/bindable.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/ransack-1.6.6/lib/ransack/nodes/bindable.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/ransack-1.6.6/lib/ransack/nodes/bindable.rb
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/ransack-1.6.2/lib/ransack/nodes/bindable.rb
ransack-1.6.6 lib/ransack/nodes/bindable.rb
ransack-1.6.5 lib/ransack/nodes/bindable.rb
ransack-1.6.4 lib/ransack/nodes/bindable.rb
ransack-1.6.3 lib/ransack/nodes/bindable.rb
ransack-1.6.2 lib/ransack/nodes/bindable.rb
ransack-1.6.1 lib/ransack/nodes/bindable.rb
ransack-1.6.0 lib/ransack/nodes/bindable.rb