• R
    Fix `reflection.association_primary_key` for `has_many` associations · b23e8696
    Ryuta Kamizono 提交于
    It is incorrect to treat `options[:primary_key]` as
    `association_primary_key` if `has_many` associations because the
    `:primary_key` means the column on the owner record, not on the
    association record. It will break `ids_reader` and `ids_writer`.
    
    ```ruby
      people(:david).essay_ids
      # => ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column 'essays.first_name' in 'field list': SELECT `essays`.first_name FROM `essays` WHERE `essays`.`writer_id` = 'David'
    ```
    
    Fixes #14439.
    b23e8696
has_many_through_associations_test.rb 41.3 KB