1. 20 4月, 2013 4 次提交
    • X
      if singletons belong to the contract, test them · 0400a7ff
      Xavier Noria 提交于
      Object#respond_to? returns singletons and thus we inherit that contract.
      The implementation of the predicate is good, but the test is only
      checking boolean semantics, which in this case is not enough.
      0400a7ff
    • X
      Rewrites a CHANGELOG entry. · d32ef7c7
      Xavier Noria 提交于
      The entry is basically copy & paste of the commit message, but the CHANGELOG
      has a different purpose than Git history, it just communicates what is new:
      
      * No need to explain why did the bug happen (unless it is truly relevant).
      
      * No need to explain how was the bug fixed.
      
      * Whether the user gives new names to columns does not really matter, use of
        select to cherry-pick a column for example also presented that behaviour.
        Non-selected attributes are the key, either because they were not included
        in the selected list, or because they were but with a different alias.
      
      * In the case of an attribute alias, what you really want to depict is that
        respond_to? returns false for the original attribute name.
      d32ef7c7
    • P
      Typo Fix in AR CHANGELOG [ci skip] · 42df4b57
      Prathamesh Sonpatki 提交于
      42df4b57
    • N
      fix respond_to? for non selected column · 66001f36
      Neeraj Singh 提交于
      fixes #4208
      
      If a query selects only a few columns and gives custom names to
      those columns then respond_to? was returning true for the non
      selected columns. However calling those non selected columns
      raises exception.
      
          post = Post.select("'title' as post_title").first
      
      In the above case when `post.body` is invoked then an exception is
      raised since `body` attribute is not selected. Howevere `respond_to?`
      did not behave correctly.
      
          pos.respond_to?(:body) #=> true
      
      Reason was that Active Record calls `super` to pass the call to
      Active Model and all the columns are defined on Active Model.
      
      Fix is to actually check if the data returned from the db contains
      the data for column in question.
      66001f36
  2. 19 4月, 2013 6 次提交
  3. 18 4月, 2013 5 次提交
  4. 17 4月, 2013 1 次提交
  5. 16 4月, 2013 6 次提交
  6. 15 4月, 2013 3 次提交
  7. 13 4月, 2013 5 次提交
    • X
      hides the per thread registry instance, and caches singleton methods · e5ef3abd
      Xavier Noria 提交于
      Existing code was delegating to the instance with delegate
      macro calls, or invoking the instance method to reach
      the object and call its instance methods.
      
      But the point is to have a clean class-level interface where
      the thread local instance is hidden in the implementation.
      
      References #11c69738.
      References #10198.
      e5ef3abd
    • X
      removes calls to AR::Runtime.instance · 11c69738
      Xavier Noria 提交于
      Registries have class-level accessors to write clean code, let's
      use them. This makes style uniform also with existing usage in
      ScopeRegistry and InstrumentationRegistry.
      
      If performance of the method_missing callback was ever considered to
      be a concern, then we should stop using it altogether and probably
      remove the callback. But while we have the feature we should use it.
      11c69738
    • X
      simplifies the RDoc of AR::RuntimeRegistry · a548c459
      Xavier Noria 提交于
      The previous version was kind of duplicating the documentation of
      AS::PerThreadRegistry. Just say how to use it, the thread locals
      registry is know part of our vocabulary (though a pointer to
      Active Support is added for reference).
      a548c459
    • X
      complete rewrite of the documentation of AS::PerThreadRegistry · 2d42fe7f
      Xavier Noria 提交于
      * It focuses on how to use it.
      
      * Removes some ambigueties in the original docs about whether the state is stored in the class.
      
      * Documents it provides class-level accessors via method_missing.
      
      * Documents that if the extended class has an initializer, it must accept no arguments.
      2d42fe7f
    • F
  8. 12 4月, 2013 4 次提交
  9. 11 4月, 2013 6 次提交