1. 26 11月, 2015 1 次提交
  2. 04 11月, 2015 1 次提交
  3. 02 11月, 2015 1 次提交
  4. 31 10月, 2015 1 次提交
  5. 25 10月, 2015 1 次提交
  6. 18 10月, 2015 2 次提交
  7. 17 10月, 2015 1 次提交
  8. 16 10月, 2015 1 次提交
  9. 14 10月, 2015 1 次提交
    • Y
      applies new doc guidelines to Active Record. · 428d47ad
      Yves Senn 提交于
      The focus of this change is to make the API more accessible.
      References to method and classes should be linked to make it easy to
      navigate around.
      
      This patch makes exzessiv use of `rdoc-ref:` to provide more readable
      docs. This makes it possible to document `ActiveRecord::Base#save` even
      though the method is within a separate module
      `ActiveRecord::Persistence`. The goal here is to bring the API closer to
      the actual code that you would write.
      
      This commit only deals with Active Record. The other gems will be
      updated accordingly but in different commits. The pass through Active
      Record is not completely finished yet. A follow up commit will change
      the spots I haven't yet had the time to update.
      
      /cc @fxn
      428d47ad
  10. 13 10月, 2015 2 次提交
  11. 08 10月, 2015 1 次提交
  12. 02 10月, 2015 1 次提交
  13. 26 9月, 2015 2 次提交
  14. 22 9月, 2015 1 次提交
  15. 05 9月, 2015 1 次提交
    • S
      #where fails if opts.responds_to?(:==) unexpectedly · c431f175
      Samuel Williams 提交于
      Sometimes opts passed in might respond to ==, e.g. `Arel::Nodes::Grouping`. In this case, `opts == :chain` returns `Arel::Nodes::Equality` which causes odd behaviour. Prefer `if :chain == opts` which guarantees that `Symbol#==` would be invoked. Alternatively consider `eql?`.
      c431f175
  16. 20 6月, 2015 1 次提交
    • S
      Include `Enumerable` in `ActiveRecord::Relation` · b644964b
      Sean Griffin 提交于
      After discussing, we've decided it makes more sense to include it. We're
      already forwarding every conflicting method to `to_a`, and there's no
      conflation of concerns. `Enumerable` has no mutating methods, and it
      just allows us to simplify the code. No existing methods will have a
      change in behavior. Un-overridden Enumerable methods will simply
      delegate to `each`.
      
      [Sean Griffin & bogdan]
      b644964b
  17. 31 5月, 2015 1 次提交
    • S
      Ensure symbols passed to `select` are always quoted · 0ef7e73f
      Sean Griffin 提交于
      Our general contract in Active Record is that strings are assumed to be
      SQL literals, and symbols are assumed to reference a column. If a from
      clause is given, we shouldn't include the table name, but we should
      still quote the value as if it were a column.
      
      Upon fixing this, the tests were still failing on SQLite. This was
      because the column name being returned by the query was `"\"join\""`
      instead of `"join"`. This is actually a bug in SQLite that was fixed a
      long time ago, but I was using the version of SQLite included by OS X
      which has this bug. Since I'm guessing this will be a common case for
      contributors, I also added an explicit check with a more helpful error
      message.
      
      Fixes #20360
      0ef7e73f
  18. 26 5月, 2015 1 次提交
    • Y
      deprecate `Relation#uniq` use `Relation#distinct` instead. · adfab2dc
      Yves Senn 提交于
      See #9683 for the reasons we switched to `distinct`.
      
      Here is the discussion that triggered the actual deprecation #20198.
      
      `uniq`, `uniq!` and `uniq_value` are still around.
      They will be removed in the next minor release after Rails 5.
      adfab2dc
  19. 19 5月, 2015 1 次提交
  20. 25 2月, 2015 2 次提交
  21. 29 1月, 2015 3 次提交
  22. 28 1月, 2015 6 次提交
    • S
      Remove Relation#bind_params · b06f64c3
      Sean Griffin 提交于
      `bound_attributes` is now used universally across the board, removing
      the need for the conversion layer. These changes are mostly mechanical,
      with the exception of the log subscriber. Additional, we had to
      implement `hash` on the attribute objects, so they could be used as a
      key for query caching.
      b06f64c3
    • S
      Use an `Attribute` object to represent a bind value · 6c235dd9
      Sean Griffin 提交于
      The column is primarily used for type casting, which we're trying to
      separate from the idea of a column. Since what we really need is the
      combination of a name, type, and value, let's use the object that we
      already have to represent that concept, rather than this tuple. No
      consumers of the bind values have been changed, only the producers
      (outside of tests which care too much about internals). This is
      *finally* possible since the bind values are now produced from a
      reasonable number of lcoations.
      6c235dd9
    • S
      Minor refactorings on `Relation#build_joins` · ae299dd4
      Sean Griffin 提交于
      Attempting to grok this code by refactoring it as I go through it.
      ae299dd4
    • S
      Use the `WhereClause` ast building logic for having · c2c95cd2
      Sean Griffin 提交于
      c2c95cd2
    • S
      Move where grouping into `WhereClause` · a5fcdae0
      Sean Griffin 提交于
      a5fcdae0
    • S
      Unify access to bind values on Relation · 16ce2eec
      Sean Griffin 提交于
      The bind values can come from four places. `having`, `where`, `joins`,
      and `from` when selecting from a subquery that contains binds. These
      need to be kept in a specific order, since the clauses will always
      appear in that order. Up until recently, they were not.
      
      Additionally, `joins` actually did keep its bind values in a separate
      location (presumably because it's the only case that people noticed was
      broken). However, this meant that anything accessing just `bind_values`
      was broken (which most places were). This is no longer possible, there
      is only a single way to access the bind values, and it includes joins in
      the proper location. The setter was removed yesterday, so breaking `+=`
      cases is not possible.
      
      I'm still not happy that `joins` is putting it's bind values on the
      Arel AST, and I'm planning on refactoring it further, but this removes a
      ton of bug cases.
      16ce2eec
  23. 27 1月, 2015 5 次提交
    • S
      Move the `from` bind logic to a `FromClause` class · bdc51416
      Sean Griffin 提交于
      Contrary to my previous commit message, it wasn't overkill, and led to
      much cleaner code.
      
      [Sean Griffin & anthonynavarre]
      bdc51416
    • S
      Remove `Relation#bind_values=` · 8436e2c2
      Sean Griffin 提交于
      The last place that was assigning it was when `from` is called with a
      relation to use as a subquery. The implementation was actually
      completely broken, and would break if you called `from` more than once,
      or if you called it on a relation, which also had its own join clause,
      as the bind values would get completely scrambled. The simplest solution
      was to just move it into its own array, since creating a `FromClause`
      class for this would be overkill.
      8436e2c2
    • S
      765a3123
    • S
      Remove `Relation#build_where` · 76661dc6
      Sean Griffin 提交于
      All of its uses have been moved to better places
      76661dc6
    • S
      Change `having_values` to use the `WhereClause` class · 39f2c3b3
      Sean Griffin 提交于
      This fixed an issue where `having` can only be called after the last
      call to `where`, because it messes with the same `bind_values` array.
      With this change, the two can be called as many times as needed, in any
      order, and the final query will be correct. However, once something
      assigns `bind_values`, that stops. This is because we have to move all
      of the bind values from the having clause over to the where clause since
      we can't differentiate the two, and assignment was likely in the form
      of:
      
      `relation.bind_values += other.bind_values`
      
      This will go away once we remove all places that are assigning
      `bind_values`, which is next on the list.
      
      While this fixes a bug that was present in at least 4.2 (more likely
      present going back as far as 3.0, becoming more likely in 4.1 and later
      as we switched to prepared statements in more cases), I don't think this
      can be easily backported. The internal changes to `Relation` are
      non-trivial, anything that involves modifying the `bind_values` array
      would need to change, and I'm not confident that we have sufficient test
      coverage of all of those locations (when `having` was called with a hash
      that could generate bind values).
      
      [Sean Griffin & anthonynavarre]
      39f2c3b3
  24. 26 1月, 2015 2 次提交