Sha256: c6c0d2e93b08f6b1106867f0bdfaf8e7c3b1090cfc15437dec209bbd9786e867
Contents?: true
Size: 586 Bytes
Versions: 2
Compression:
Stored size: 586 Bytes
Contents
require 'active_record' ::ActiveRecord::Associations::Builder::HasOne.class_eval do # Based on # https://github.com/rails/rails/blob/master/activerecord/lib/active_record/associations/builder/collection_association.rb#L50 # https://github.com/rails/rails/blob/master/activerecord/lib/active_record/associations/builder/singular_association.rb#L11 def self.define_accessors(mixin, reflection) super name = reflection.name mixin.class_eval <<-CODE, __FILE__, __LINE__ + 1 def #{name.to_s}_id association(:#{name}).reader.id end CODE end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fast_jsonapi-1.0.17 | lib/extensions/has_one.rb |
fast_jsonapi-1.0.16 | lib/extensions/has_one.rb |