Sha256: 03a86e887f8229d60e2264b16032a50704daae2a7d77ad28e734b2c461c81369

Contents?: true

Size: 640 Bytes

Versions: 1

Compression:

Stored size: 640 Bytes

Contents

if defined? ActiveRecord
  class ActiveRecord::Associations::Association

    # dump association can trigger ActiveSupport::JSON::Encoding::CircularReferenceError when use rails ~> 4.0.1
    # I try other json gems to fix it, but all failed. That's why I override it here.
    def to_json(options = nil)
      JSON.dump(to_s)
    end
  end

  class ActiveRecord::Base

    # dump association can trigger ActiveSupport::JSON::Encoding::CircularReferenceError when use rails ~> 4.0.1
    # I try other json gems to fix it, but all failed. That's why I override it here.
    def to_json(options = nil)
      JSON.dump(to_s)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
source_route-0.1.3 lib/source_route/json_overrides/activerecord_associations_association.rb