Module: Dart::NamingConventions::ManyToManyAssociationHelpers
Instance Method Summary
collapse
#naming_conventions, #set_conventional_name!
Instance Method Details
#conventional_name ⇒ String
Returns the name of a referenced association according to the naming convention
10
11
12
13
|
# File 'lib/dart/naming_conventions/many_to_many_association_helpers.rb', line 10
def conventional_name
naming_conventions.plural_association_name(right_ass.foreign_key)
end
|
#disambiguate_name! ⇒ Object
forces long-form name to disambiguate from other joins to same association, where short-form name is the same
33
34
35
36
37
38
|
# File 'lib/dart/naming_conventions/many_to_many_association_helpers.rb', line 33
def disambiguate_name!
unless is_semi_conventional_join_table?
set_name! naming_conventions.long_association_name(join_table, left_ass.foreign_key, left_ass.parent_table, right_ass.foreign_key)
end
end
|
#left_foreign_key_is_conventional? ⇒ Boolean
24
25
26
|
# File 'lib/dart/naming_conventions/many_to_many_association_helpers.rb', line 24
def left_foreign_key_is_conventional?
left_ass.conventional_foreign_key?
end
|
#name_and_right_foreign_key_are_conventional? ⇒ Boolean
19
20
21
22
|
# File 'lib/dart/naming_conventions/many_to_many_association_helpers.rb', line 19
def name_and_right_foreign_key_are_conventional?
name_is_conventional? && right_foreign_key_is_conventional?
end
|
#name_is_conventional? ⇒ Boolean
15
16
17
|
# File 'lib/dart/naming_conventions/many_to_many_association_helpers.rb', line 15
def name_is_conventional?
name == associated_table
end
|
#right_foreign_key_is_conventional? ⇒ Boolean
28
29
30
|
# File 'lib/dart/naming_conventions/many_to_many_association_helpers.rb', line 28
def right_foreign_key_is_conventional?
right_ass.conventional_foreign_key?
end
|