Method: Binda::FieldableAssociationHelpers::FieldableRepeaterHelpers#has_repeaters

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

#has_repeaters(field_slug) ⇒ boolean

Check if exists any repeater with that slug

Parameters:

  • field_slug (string)

    The slug of the field setting

Returns:

  • (boolean)

Raises:

  • (ArgumentError)


8
9
10
11
12
# File 'app/models/concerns/binda/fieldable_association_helpers/fieldable_repeater_helpers.rb', line 8

def has_repeaters(field_slug)
	obj = self.repeaters.find_all{ |t| t.field_setting_id == FieldSetting.get_id( field_slug ) }
	raise ArgumentError, "There isn't any repeater associated to the current slug (#{field_slug}) on instance (#{self.class.name} ##{self.id}).", caller if obj.nil?
	return obj.present?
end