secret
Created

  • Download Gist
gistfile1.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# TODO: Temporary patch until https://github.com/rails/rails/issues/8269 is resolved.
warn "WARNING: patch `#{__FILE__}' may break Rails #{Rails.version}" if Rails.version != '3.2.13'
 
# activerecord/lib/active_record/associations/has_many_through_association.rb
class ActiveRecord::Associations::HasManyThroughAssociation
private
 
def save_through_record(record)
through_record = build_through_record(record)
if inverse = through_reflection.inverse_of
through_record.send("#{inverse.name}=", owner) if inverse.macro == :belongs_to
end
through_record.save!
ensure
@through_records.delete(record.object_id)
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.