Module: Dart::NamingConventions::DirectAssociationHelpers
- Included in:
- ManyToOneAssociationHelpers, OneToManyAssociationHelpers
- Defined in:
- lib/dart/naming_conventions/direct_association_helpers.rb
Instance Method Summary collapse
-
#conventional_foreign_key? ⇒ Boolean
Returns true if this association has a conventionally named foreign key based on the parent table name.
-
#conventional_parent?(table_name) ⇒ Boolean
Returns true if this association has a conventional foreign key pointing to the given table_name.
-
#conventional_primary_key? ⇒ Boolean
Returns true if this association has a conventional primary key on the parent table.
Instance Method Details
#conventional_foreign_key? ⇒ Boolean
Returns true if this association has a conventionally named foreign key based on the parent table name
16 17 18 |
# File 'lib/dart/naming_conventions/direct_association_helpers.rb', line 16 def conventional_foreign_key? parent_table == naming_conventions.parent_table_for(foreign_key) end |
#conventional_parent?(table_name) ⇒ Boolean
Returns true if this association has a conventional foreign key pointing to the given table_name
6 7 8 |
# File 'lib/dart/naming_conventions/direct_association_helpers.rb', line 6 def conventional_parent?(table_name) parent_table == table_name && conventional_foreign_key? end |
#conventional_primary_key? ⇒ Boolean
Returns true if this association has a conventional primary key on the parent table
11 12 13 |
# File 'lib/dart/naming_conventions/direct_association_helpers.rb', line 11 def conventional_primary_key? primary_key == naming_conventions.conventional_primary_key end |