Module: Avo::Fields::FieldExtensions::HasFieldName

Included in:
BaseField
Defined in:
lib/avo/fields/field_extensions/has_field_name.rb

Instance Method Summary collapse

Instance Method Details

#field_name(name) ⇒ Object

Set the field name



6
7
8
# File 'lib/avo/fields/field_extensions/has_field_name.rb', line 6

def field_name(name)
  self.field_name_attribute = name
end

#get_field_nameObject

Get the field name



11
12
13
14
15
# File 'lib/avo/fields/field_extensions/has_field_name.rb', line 11

def get_field_name
  return field_name_attribute if field_name_attribute.present?

  to_s.demodulize.underscore.gsub "_field", ""
end