class ParsleySimpleForm::Constraints::BaseConstraint

Public Class Methods

new(form_builder,options,&block) click to toggle source
# File lib/parsley_simple_form/constraints/base_constraint.rb, line 5
def initialize(form_builder,options,&block)
  @form_builder = form_builder
  @options = options
  @block = block
end

Public Instance Methods

input_id(attribute_name, options, &block) click to toggle source
# File lib/parsley_simple_form/constraints/base_constraint.rb, line 16
def input_id(attribute_name, options, &block)
  input = @form_builder.find_input(attribute_name, options, &block)
  if input.lookup_model_names.count > 1
    (input.lookup_model_names * '_') + '_attributes_' + input.attribute_name.to_s
  else
    (input.lookup_model_names * '_') + '_' + input.attribute_name.to_s
  end        
end
input_type(attribute_name, options, &block) click to toggle source
# File lib/parsley_simple_form/constraints/base_constraint.rb, line 11
def input_type(attribute_name, options, &block)
  input = @form_builder.find_input(attribute_name, options, &block)
  input.input_type or :string
end