class ActiveFedora::Associations::Builder::DirectlyContainsOne

def self.inherit_options_from_association(model, options, association_name)

Parameters:
  • association_name (Symbol) -- of the association to inherit from
def self.inherit_options_from_association(model, options, association_name)
  associated_through_reflection = model._reflect_on_association(association_name)
  raise ArgumentError, "You specified `:through => #{@reflection.options[:through]}` on the #{name} associaiton but #{model} does not actually have a #{@reflection.options[:through]}` association" if associated_through_reflection.nil? || !associated_through_reflection.name
  raise ArgumentError, "You must specify a directly_contains association as the :through option on #{name}.  You provided a #{associated_through_reflection.macro}" unless associated_through_reflection.macro == :directly_contains
  options[:has_member_relation] = associated_through_reflection.options[:has_member_relation] unless options[:has_member_relation]
  options[:class_name] = associated_through_reflection.options[:class_name] unless options[:class_name] && options[:class_name] != "ActiveFedora::File"
end