class ActiveFacts::Composition::Traits::Rails::ForeignKey
Public Instance Methods
from_association_name()
click to toggle source
A foreign key is between two Composites, but involves some Absorption that traverses between two object types, either or both of which may be fully absorbed into the respective Composites. The name of a foreign key takes this into account.
# File lib/activefacts/compositions/traits/rails.rb, line 147 def from_association_name mapping.column_name.snakecase end
to_association()
click to toggle source
# File lib/activefacts/compositions/traits/rails.rb, line 151 def to_association if mapping && mapping.child_role.is_unique [ "has_one", source_composite.rails.singular_name] else [ "has_many", source_composite.rails.plural_name] end end