Class: ParsleySimpleForm::Constraints::BaseConstraint
- Inherits:
-
Object
- Object
- ParsleySimpleForm::Constraints::BaseConstraint
- Defined in:
- lib/parsley_simple_form/constraints/base_constraint.rb
Direct Known Subclasses
ParsleySimpleForm::Constraints::Basics::EqualtoConstraint, ParsleySimpleForm::Constraints::Basics::MaxConstraint, ParsleySimpleForm::Constraints::Basics::MaxLengthConstraint, ParsleySimpleForm::Constraints::Basics::MaxcheckConstraint, ParsleySimpleForm::Constraints::Basics::MinConstraint, ParsleySimpleForm::Constraints::Basics::MinLengthConstraint, ParsleySimpleForm::Constraints::Basics::MincheckConstraint, ParsleySimpleForm::Constraints::Basics::NotBlankConstraint, ParsleySimpleForm::Constraints::Basics::RangeConstraint, ParsleySimpleForm::Constraints::Basics::RangeLengthConstraint, ParsleySimpleForm::Constraints::Basics::RangecheckConstraint, ParsleySimpleForm::Constraints::Basics::RegexpConstraint, ParsleySimpleForm::Constraints::Basics::RequiredConstraint, ParsleySimpleForm::Constraints::Basics::TypeConstraint
Instance Method Summary collapse
-
#initialize(form_builder, options, &block) ⇒ BaseConstraint
constructor
A new instance of BaseConstraint.
- #input_id(attribute_name, options, &block) ⇒ Object
- #input_type(attribute_name, options, &block) ⇒ Object
Constructor Details
#initialize(form_builder, options, &block) ⇒ BaseConstraint
Returns a new instance of BaseConstraint.
5 6 7 8 9 |
# File 'lib/parsley_simple_form/constraints/base_constraint.rb', line 5 def initialize(form_builder,,&block) @form_builder = form_builder @options = @block = block end |
Instance Method Details
#input_id(attribute_name, options, &block) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/parsley_simple_form/constraints/base_constraint.rb', line 16 def input_id(attribute_name, , &block) input = @form_builder.find_input(attribute_name, , &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) ⇒ Object
11 12 13 14 |
# File 'lib/parsley_simple_form/constraints/base_constraint.rb', line 11 def input_type(attribute_name, , &block) input = @form_builder.find_input(attribute_name, , &block) input.input_type or :string end |