Class: AgreementRelationship
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- AgreementRelationship
- Defined in:
- app/models/agreement_relationship.rb
Class Method Summary collapse
-
.for_relationship_type(rel_type) ⇒ Object
convenience class methods to return an instance of this class with the from_role, to_role and relationship_type set using an internal_identifier for the relationship_type.
- .for_relationship_type_identifier(internal_identifier) ⇒ Object
-
.for_reln_type_id(internal_identifier) ⇒ Object
this is a shortcut for the ‘self.for_relationship_type_identifier( internal_identifier )’ method.
Class Method Details
.for_relationship_type(rel_type) ⇒ Object
convenience class methods to return an instance of this class with the from_role, to_role and relationship_type set using an internal_identifier for the relationship_type. Note that you still need to set the from and to parties and any contracts / accounts.
16 17 18 19 20 21 22 |
# File 'app/models/agreement_relationship.rb', line 16 def self.for_relationship_type( rel_type ) reln = self.new reln.relationship_type = rel_type reln.from_role = rel_type.valid_from_role reln.to_role = rel_type.valid_to_role reln end |
.for_relationship_type_identifier(internal_identifier) ⇒ Object
24 25 26 27 |
# File 'app/models/agreement_relationship.rb', line 24 def self.for_relationship_type_identifier( internal_identifier ) relationship_type = AgreementRelnType.find_by_internal_identifier( internal_identifier ) self.for_relationship_type( relationship_type ) end |
.for_reln_type_id(internal_identifier) ⇒ Object
this is a shortcut for the ‘self.for_relationship_type_identifier( internal_identifier )’ method
30 31 32 |
# File 'app/models/agreement_relationship.rb', line 30 def self.for_reln_type_id( internal_identifier ) self.for_relationship_type_identifier( internal_identifier ) end |