1. 01 4月, 2015 1 次提交
  2. 12 3月, 2015 1 次提交
    • B
      Isolate access to .default_scopes in ActiveRecord::Scoping::Default · c1deb81c
      Ben Woosley 提交于
      Instead use .scope_attributes? consistently in ActiveRecord to check whether
      there are attributes currently associated with the scope.
      
      Move the implementation of .scope_attributes? and .scope_attributes to
      ActiveRecord::Scoping because they don't particularly have to do specifically
      with Named scopes and their only dependency, in the case of
      .scope_attributes?, and only caller, in the case of .scope_attributes is
      contained in Scoping.
      c1deb81c
  3. 07 3月, 2014 2 次提交
  4. 22 2月, 2014 1 次提交
  5. 01 9月, 2013 1 次提交
  6. 02 7月, 2013 2 次提交
  7. 09 4月, 2013 2 次提交
  8. 07 4月, 2013 1 次提交
  9. 24 3月, 2013 1 次提交
  10. 29 1月, 2013 1 次提交
  11. 30 10月, 2012 1 次提交
  12. 29 10月, 2012 1 次提交
  13. 22 9月, 2012 1 次提交
  14. 03 8月, 2012 2 次提交
  15. 02 7月, 2012 1 次提交
  16. 16 6月, 2012 1 次提交
  17. 25 4月, 2012 2 次提交
  18. 11 4月, 2012 1 次提交
  19. 22 3月, 2012 1 次提交
    • J
      Deprecate eager-evaluated scopes. · 0a12a5f8
      Jon Leighton 提交于
      Don't use this:
      
          scope :red, where(color: 'red')
          default_scope where(color: 'red')
      
      Use this:
      
          scope :red, -> { where(color: 'red') }
          default_scope { where(color: 'red') }
      
      The former has numerous issues. It is a common newbie gotcha to do
      the following:
      
          scope :recent, where(published_at: Time.now - 2.weeks)
      
      Or a more subtle variant:
      
          scope :recent, -> { where(published_at: Time.now - 2.weeks) }
          scope :recent_red, recent.where(color: 'red')
      
      Eager scopes are also very complex to implement within Active
      Record, and there are still bugs. For example, the following does
      not do what you expect:
      
          scope :remove_conditions, except(:where)
          where(...).remove_conditions # => still has conditions
      0a12a5f8
  20. 29 12月, 2011 1 次提交
    • J
      Support configuration on ActiveRecord::Model. · 93c1f11c
      Jon Leighton 提交于
      The problem: We need to be able to specify configuration in a way that
      can be inherited to models that include ActiveRecord::Model. So it is
      no longer sufficient to put 'top level' config on ActiveRecord::Base,
      but we do want configuration specified on ActiveRecord::Base and
      descendants to continue to work.
      
      So we need something like class_attribute that can be defined on a
      module but that is inherited when ActiveRecord::Model is included.
      
      The solution: added ActiveModel::Configuration module which provides a
      config_attribute macro. It's a bit specific hence I am not putting this
      in Active Support or making it a 'public API' at present.
      93c1f11c
  21. 18 12月, 2011 1 次提交
  22. 16 12月, 2011 1 次提交