Sha256: 21da66fd92d5ab1fca7540cfecf3f6d113f11bb11f3f1395f869376f8a3bf392

Contents?: true

Size: 575 Bytes

Versions: 3

Compression:

Stored size: 575 Bytes

Contents

require_relative "input_methods"

module ActiveAdminAddons
  module FilterInputMethods
    include InputMethods

    def object_class
      valid_object.klass
    end

    def input_value
      result = valid_object.conditions.find do |condition|
        condition.attributes.map(&:name).include?(valid_method.to_s)
      end

      return unless result

      result.values.first.value
    end

    def eq_input_name
      "#{valid_method}_eq"
    end

    def gteq_input_name
      "#{method}_gteq"
    end

    def lteq_input_name
      "#{method}_lteq"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activeadmin_addons-2.0.0.beta.4 lib/activeadmin_addons/support/input_helpers/filter_input_methods.rb
activeadmin_addons-2.0.0.beta.3 lib/activeadmin_addons/support/input_helpers/filter_input_methods.rb
activeadmin_addons-2.0.0.beta.2 lib/activeadmin_addons/support/input_helpers/filter_input_methods.rb