Class: Form::BaseTag

Inherits:
UI::Base
  • Object
show all
Defined in:
app/views/form/base_tag.rb

Direct Known Subclasses

Checkbox, Error, Hint, Input, Label, RadioButton, Select

Constant Summary collapse

ALLOWED_OPTIONS =
[:readonly, :disabled, :name, :autofocus, :data].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.allowed_optionsObject



7
8
9
# File 'app/views/form/base_tag.rb', line 7

def allowed_options
  ALLOWED_OPTIONS
end

Instance Method Details

#idObject



17
18
19
# File 'app/views/form/base_tag.rb', line 17

def id
  form.field_id(method)
end

#nameObject



21
22
23
# File 'app/views/form/base_tag.rb', line 21

def name
  form.field_name(method)
end

#valueObject



25
26
27
28
29
30
31
# File 'app/views/form/base_tag.rb', line 25

def value
  return @value if @value
  return if form.object.blank?
  return unless form.object.respond_to?(method)

  form.object.public_send(method)
end