Class: DataWorks::Relationships
- Inherits:
-
Object
- Object
- DataWorks::Relationships
- Defined in:
- lib/data_works/relationships.rb
Class Method Summary collapse
- .autocreated_children=(hash) ⇒ Object
- .autocreated_children_of(model_name) ⇒ Object
- .necessary_parents=(hash) ⇒ Object
- .necessary_parents_for(model_name) ⇒ Object
Class Method Details
.autocreated_children=(hash) ⇒ Object
4 5 6 |
# File 'lib/data_works/relationships.rb', line 4 def self.autocreated_children=(hash) @autocreated_children = hash end |
.autocreated_children_of(model_name) ⇒ Object
8 9 10 |
# File 'lib/data_works/relationships.rb', line 8 def self.autocreated_children_of(model_name) @autocreated_children[model_name] || [] end |
.necessary_parents=(hash) ⇒ Object
12 13 14 15 |
# File 'lib/data_works/relationships.rb', line 12 def self.necessary_parents=(hash) @necessary_parents = hash StaleRelationshipChecker.check! end |
.necessary_parents_for(model_name) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/data_works/relationships.rb', line 17 def self.necessary_parents_for(model_name) result = @necessary_parents[model_name] if result.nil? = "The model '#{model_name}' is not registered. " << "It should be registered in the DataWorks.configure section " << "of your spec_helper.rb file." raise DataWorksError.new() end result.map{|x| NecessaryParent.new(x)} end |