Method: Tripod::Fields::ClassMethods#get_field

Defined in:
lib/tripod/fields.rb

#get_field(name) ⇒ Object

Return the field object on a Resource associated with the given name.

Examples:

Get the field.

Person.get_field(:name)

Parameters:

  • name (Symbol)

    The name of the field.

Raises:



56
57
58
59
60
61
# File 'lib/tripod/fields.rb', line 56

def get_field(name)
  @fields ||= {}
  field = fields[name]
  raise Tripod::Errors::FieldNotPresent.new unless field
  field
end