Module: Dart::NamingConventions::OneToManyAssociationHelpers

Includes:
AssociationHelpers, DirectAssociationHelpers
Included in:
Database::OneToManyAssociation
Defined in:
lib/dart/naming_conventions/one_to_many_association_helpers.rb

Instance Method Summary collapse

Methods included from DirectAssociationHelpers

#conventional_foreign_key?, #conventional_parent?, #conventional_primary_key?

Methods included from AssociationHelpers

#naming_conventions, #set_conventional_name!

Instance Method Details

#conventional_nameString

Returns the name of a referenced association according to the naming convention

Returns:

  • (String)

    the name of the referenced association



11
12
13
14
15
16
17
# File 'lib/dart/naming_conventions/one_to_many_association_helpers.rb', line 11

def conventional_name
  if conventional_foreign_key?
    associated_table
  else
    "#{naming_conventions.singular_association_name(foreign_key)}_#{child_table}"
  end
end

#name_is_conventional?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/dart/naming_conventions/one_to_many_association_helpers.rb', line 19

def name_is_conventional?
  name == associated_table
end