1. 27 12月, 2014 6 次提交
    • S
      Remove `klass` and `arel_table` as a dependency of `PredicateBuilder` · a60770d3
      Sean Griffin 提交于
      This class cares far too much about the internals of other parts of
      Active Record. This is an attempt to break out a meaningful object which
      represents the needs of the predicate builder. I'm not fully satisfied
      with the name, but the general concept is an object which represents a
      table, the associations to/from that table, and the types associated
      with it. Many of these exist at the `ActiveRecord::Base` class level,
      not as properties of the table itself, hence the need for another
      object. Currently it provides these by holding a reference to the class,
      but that will likely change in the future. This allows the predicate
      builder to remain wholy concerned with building predicates.
      
      /cc @mrgilman
      a60770d3
    • S
      Refactor association handling in `PredicateBuilder` · 3bbe88ec
      Sean Griffin 提交于
      I'm attempting to remove `klass` as a dependency of the predicate
      builder, in favor of an object that better represents what we're using
      it for. The only part of this which doesn't fit nicely into that picture
      is the check for an association being polymorphic. Since I'm not yet
      sure what that is going to look like, I've moved this logic into another
      class in an attempt to separate things that will change from things that
      won't.
      3bbe88ec
    • S
      Re-use the predicate builder in the `ArrayHandler` · 392a453b
      Sean Griffin 提交于
      This reduces the number of places which will need to care about single
      value or range specific logic as we introduce type casting. The array
      handler is only responsible for producing `in` statements.
      
      /cc @mrgilman
      
      [Sean Griffin & Melanie Gilman]
      392a453b
    • S
      Change `PredicateBuilder` handler methods to instance methods · a3936bbe
      Sean Griffin 提交于
      This will allow us to pass the predicate builder into the constructor of
      these handlers. The procs had to be changed to objects, because the
      `PredicateBuilder` needs to be marshalable. If we ever decide to make
      `register_handler` part of the public API, we should come up with a
      better solution which allows procs.
      
      /cc @mrgilman
      
      [Sean Griffin & Melanie Gilman]
      a3936bbe
    • S
      Add missing `:nodoc:` · af55197d
      Sean Griffin 提交于
      We're accidentally documenting `PredicateBuilder` and `ArrayHandler`
      since there's a constant which is missing `# :nodoc:`
      af55197d
    • S
      Inject the `PredicateBuilder` into the `Relation` instance · 1d6bb776
      Sean Griffin 提交于
      Construction of relations can be a hotspot, we don't want to create one
      of these in the constructor. This also allows us to do more expensive
      things in the predicate builder's constructor, since it's created once
      per AR::Base subclass
      1d6bb776
  2. 19 12月, 2014 1 次提交
    • M
      Clarity start parameter · d557f1ba
      Michael Dawson 提交于
      I find that `Specifies the starting point for the batch processing.`
      does not give enough information for me to understand what this
      parameter actually does.
      d557f1ba
  3. 11 12月, 2014 1 次提交
  4. 05 12月, 2014 2 次提交
  5. 04 12月, 2014 1 次提交
  6. 03 12月, 2014 2 次提交
  7. 02 12月, 2014 1 次提交
  8. 30 11月, 2014 2 次提交
    • S
      Update Arel usage for rails/arel#98fc2599 · a975407a
      Sean Griffin 提交于
      `where_sql` now requires that we pass it an engine. None of the manager
      classes take an engine in their constructor.
      a975407a
    • S
      Stop using `Arel::Table.engine` · de239066
      Sean Griffin 提交于
      We never actually make use of it on the table, since we're constructing
      the select manager manually. It looks like if we ever actually were
      grabbing it from the table, we're grossly misusing it since it's meant
      to vary by AR class.
      
      Its existence on `Arel::Table` appears to be purely for convenience
      methods that are never used outside of tests. However, in production
      code it just complicates construction of the tables on the rails side,
      and the plan is to remove it from `Arel::Table` entirely. I'm not
      convinced it needs to live on `SelectManager`, etc either.
      de239066
  9. 29 11月, 2014 1 次提交
  10. 21 11月, 2014 1 次提交
  11. 20 11月, 2014 1 次提交
  12. 18 11月, 2014 2 次提交
  13. 03 11月, 2014 2 次提交
  14. 02 11月, 2014 5 次提交
  15. 01 11月, 2014 2 次提交
    • M
      Remove redundant substitute index when constructing bind values · 08579e40
      Melanie Gilman 提交于
      We end up re-ordering them either way when we construct the Arel AST (in order
      to deal with rewhere, etc), so we shouldn't bother giving it a number in the
      first place beforehand.
      08579e40
    • S
      Treat strings greater than int max value as out of range · e62fff40
      Sean Griffin 提交于
      Sufficiently large integers cause `find` and `find_by` to raise
      `StatementInvalid` instead of `RecordNotFound` or just returning `nil`.
      Given that we can't cast to `nil` for `Integer` like we would with junk
      data for other types, we raise a `RangeError` instead, and rescue in
      places where it would be highly unexpected to get an exception from
      casting.
      
      Fixes #17380
      e62fff40
  16. 31 10月, 2014 1 次提交
    • S
      Don't require calculations to be aliased to a column · 53ec0bc0
      Sean Griffin 提交于
      Arel has changed so that `.sum` no longer aliases `SUM(the_column)` to
      `sum_id`. This means the type returned by the adapter will be at the key
      `"SUM(the_column)"`. Longer term, we should eventually be able to retain
      type information from the AR::Base subclasses used in joined queries
      53ec0bc0
  17. 30 10月, 2014 1 次提交
  18. 29 10月, 2014 3 次提交
    • X
      let's warn with heredocs · b3bfa361
      Xavier Noria 提交于
      The current style for warning messages without newlines uses
      concatenation of string literals with manual trailing spaces
      where needed.
      
      Heredocs have better readability, and with `squish` we can still
      produce a single line.
      
      This is a similar use case to the one that motivated defining
      `strip_heredoc`, heredocs are super clean.
      b3bfa361
    • S
      Remove unneccessary default values from relation merger · 52153234
      Sean Griffin 提交于
      The value methods will default to an empty array for us automatically
      52153234
    • S
      Call value methods when merging relations, rather than accessing keys · fa7c004d
      Sean Griffin 提交于
      The change to accessing keys directly was originally added to allow
      `merge` to take a hash. The implementation of `HashMerger` no longer
      requires us to be doing so. Accessing the values directly makes it
      impossible to change internal storage details, even if shim methods are
      added temporarily
      fa7c004d
  19. 27 10月, 2014 1 次提交
  20. 20 10月, 2014 3 次提交
  21. 14 10月, 2014 1 次提交
    • C
      Remove duplicate error message "Couldn't find..." · 90a0471a
      claudiob 提交于
      This commit removes the duplication of the error message:
      
      > Couldn't find #{@klass.name} with [#{arel.where_sql}]
      
      introduced in #15791 by adding a private method `find_nth!` that
      deals with all the method like `first!` and `second!`.
      90a0471a