Class: FieldDefinitions::TextField

Inherits:
FieldDefinition
  • Object
show all
Defined in:
app/models/iron/field_definitions/text_field.rb

Instance Method Summary collapse

Instance Method Details

#allowed_values_textObject



5
6
7
# File 'app/models/iron/field_definitions/text_field.rb', line 5

def allowed_values_text
  Array(allowed_values).join("\n")
end

#allowed_values_text=(text) ⇒ Object



9
10
11
# File 'app/models/iron/field_definitions/text_field.rb', line 9

def allowed_values_text=(text)
  self.allowed_values = text.to_s.lines.map(&:strip).reject(&:blank?)
end

#requiredObject



13
14
15
# File 'app/models/iron/field_definitions/text_field.rb', line 13

def required
  ActiveModel::Type::Boolean.new.cast(super)
end

#required=(value) ⇒ Object



17
18
19
# File 'app/models/iron/field_definitions/text_field.rb', line 17

def required=(value)
  super(ActiveModel::Type::Boolean.new.cast(value))
end

#value_columnObject



21
22
23
# File 'app/models/iron/field_definitions/text_field.rb', line 21

def value_column
  :value_string
end