class DataWorks::Relationships

Public Class Methods

autocreated_children=(hash) click to toggle source
# File lib/data_works/relationships.rb, line 4
def self.autocreated_children=(hash)
  @autocreated_children = hash
end
autocreated_children_of(model_name) click to toggle source
# File lib/data_works/relationships.rb, line 8
def self.autocreated_children_of(model_name)
  @autocreated_children[model_name] || []
end
necessary_parents=(hash) click to toggle source
# File lib/data_works/relationships.rb, line 12
def self.necessary_parents=(hash)
  @necessary_parents = hash
  StaleRelationshipChecker.check!
end
necessary_parents_for(model_name) click to toggle source
# File lib/data_works/relationships.rb, line 17
def self.necessary_parents_for(model_name)
  result = @necessary_parents[model_name]
  if result.nil?
    message = "The model '#{model_name}' is not registered. "
    message << "It should be registered in the DataWorks.configure section "
    message << "of your spec_helper.rb file."
    raise DataWorksError.new(message)
  end
  result.map{|x| NecessaryParent.new(x)}
end