class ActiveRecord::Associations::Association

Public Instance Methods

build_record_with_shared_key(attributes) click to toggle source
# File lib/ext/active_record/associations/association.rb, line 24
def build_record_with_shared_key(attributes)
  share_key attributes
  build_record_without_shared_key attributes
end

Private Instance Methods

share_key(attributes) click to toggle source
# File lib/ext/active_record/associations/association.rb, line 32
def share_key(attributes)
  h = attributes.last
  if Hash === h and h.key? :shared_key
    key = h.delete :shared_key
    h.reverse_merge! foreign_key: key, primary_key: key
  end
end