1. 22 6月, 2013 4 次提交
    • Y
      test-case to prevent regressions on `Association#build` with an Array. · 951bde45
      Yves Senn 提交于
      Closes #11026
      951bde45
    • N
      flatten merged join_values before building the joins · 32420bd4
      Neeraj Singh 提交于
      fixes #10669
      
      While joining_values special treatment is given to string values.
      By flattening the array it ensures that string values are detected
      as strings and not arrays.
      32420bd4
    • N
      do not load all child records for inverse case · 82882d41
      Neeraj Singh 提交于
      currently `post.comments.find(Comment.first.id)` would load all
      comments for the given post to set the inverse association.
      
      This has a huge performance penalty. Because if post has 100k
      records and all these 100k records would be loaded in memory
      even though the comment id was supplied.
      
      Fix is to use in-memory records only if loaded? is true. Otherwise
      load the records using full sql.
      
      Fixes #10509
      82882d41
    • N
      fix bad test by making number that fits for integer · 6741a0a1
      Neeraj Singh 提交于
      PR https://github.com/rails/rails/pull/10566 had to be reverted
      because after applying the fix test
      "test_raise_record_not_found_error_when_invalid_ids_are_passed"
      started failing.
      
      In this test invalid_id is being assigned a really large number
      which was causing following failure when PR #10566 was applied.
      
      ```
      RangeError: bignum too big to convert into `long long'
      SELECT  `interests`.* FROM `interests`
      WHERE `interests`.`man_id` = ? AND `interests`.`id` = ?
      LIMIT 1  [["man_id", 970345987], ["id", 2394823094892348920348523452345]]
      ```
      
      This test is not failing in master because when test code
      `man.interests.find(invalid_id)` is executed then interests
      are fully loaded in memory and no database query is executed.
      
      After PR #10566 was merged then test code
      `man.interests.find(invalid_id)` started executing sql query
      and hence the error.
      
      In case someone is wondering why the second part of query is not
      failing, then that's because the actual query does not require
      any variable substituation where the number is large. In that
      case the sql generate is following.
      
      ```
      SELECT `interests`.* FROM `interests`
      WHERE `interests`.`man_id` = ? AND `interests`.`id`
      IN (8432342, 2390102913, 2453245234523452)  [["man_id", 970345987]]
      ```
      6741a0a1
  2. 21 6月, 2013 2 次提交
  3. 20 6月, 2013 3 次提交
  4. 19 6月, 2013 5 次提交
  5. 18 6月, 2013 2 次提交
  6. 15 6月, 2013 7 次提交
  7. 14 6月, 2013 17 次提交