Class: CaringForm::Field::LookingFor

Inherits:
Collection show all
Defined in:
lib/caring_form/field/looking_for.rb

Instance Attribute Summary

Attributes inherited from Base

#name

Instance Method Summary collapse

Methods inherited from Collection

#apply_to_model, #simple_type

Methods inherited from Base

#apply_to_model, register, #render, #simple_type

Constructor Details

#initialize(*args) ⇒ LookingFor

Returns a new instance of LookingFor.



8
9
10
11
12
13
# File 'lib/caring_form/field/looking_for.rb', line 8

def initialize(*args)
  super
  unless self.collection.present?
    self.collection = options_collection
  end
end

Instance Method Details

#input_properties(form, options = {}) ⇒ Object



15
16
17
18
19
20
# File 'lib/caring_form/field/looking_for.rb', line 15

def input_properties(form, options = {})
  options[:prompt] = "-- Choose One --" if options.fetch(:prompt, prompt).nil?
  super.tap do |req|
    req[:input_html][:title] ||= message
  end
end