Method: Binda::FieldableAssociationHelpers::FieldableDateHelpers#get_date

Defined in:
app/models/concerns/binda/fieldable_association_helpers/fieldable_date_helpers.rb

#get_date(field_slug) ⇒ boolean

Get the object related to that field setting

Parameters:

  • field_slug (string)

    The slug of the field setting

Returns:

  • (boolean)

Raises:

  • (ArgumentError)


23
24
25
26
27
# File 'app/models/concerns/binda/fieldable_association_helpers/fieldable_date_helpers.rb', line 23

def get_date(field_slug)
	obj = self.dates.find{ |t| t.field_setting_id == FieldSetting.get_id( field_slug ) }
	raise ArgumentError, "There isn't any date associated to the current slug (#{field_slug}) on instance (#{self.class.name} ##{self.id}).", caller if obj.nil?
	obj.date
end