Sha256: 4b51f26f7d4f75db6cab1b8be32c0560baae4cb91d85a26a493f3b4bd2df88a5
Contents?: true
Size: 549 Bytes
Versions: 36
Compression:
Stored size: 549 Bytes
Contents
# Bugfix: building an sti model from an association fails # https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/6306-collection-associations-build-method-not-supported-for-sti ActiveRecord::Reflection::AssociationReflection.class_eval do def build_association(*opts) col = klass.inheritance_column.to_sym if !col.nil? && opts.first.is_a?(Hash) && (opts.first.symbolize_keys[col]) sti_model = opts.first.delete(col) sti_model.to_s.camelize.constantize.new(*opts) else klass.new(*opts) end end end
Version data entries
36 entries across 36 versions & 4 rubygems