Method: Binda::FieldableAssociationHelpers::FieldableRelationHelpers#has_related_boards

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

Check if has related boards

Parameters:

  • field_slug (string)

    The slug of the field setting

Returns:

  • (boolean)

Raises:

  • (ArgumentError)


50
51
52
53
54
# File 'app/models/concerns/binda/fieldable_association_helpers/fieldable_relation_helpers.rb', line 50

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