1. 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
  2. 07 1月, 2012 1 次提交
  3. 24 12月, 2011 1 次提交
  4. 17 12月, 2011 1 次提交
  5. 13 9月, 2011 1 次提交
  6. 18 4月, 2011 1 次提交
  7. 13 4月, 2011 1 次提交
  8. 12 1月, 2011 1 次提交
  9. 09 11月, 2010 1 次提交
  10. 20 10月, 2010 1 次提交
  11. 14 8月, 2010 2 次提交
  12. 05 6月, 2010 1 次提交
  13. 18 1月, 2010 1 次提交
  14. 08 9月, 2009 2 次提交
  15. 30 7月, 2009 1 次提交
  16. 16 7月, 2009 1 次提交
  17. 12 3月, 2009 1 次提交
  18. 07 3月, 2009 2 次提交
  19. 25 1月, 2009 1 次提交
  20. 01 8月, 2008 1 次提交
  21. 09 7月, 2008 1 次提交
  22. 28 6月, 2008 1 次提交
  23. 23 6月, 2008 1 次提交
  24. 30 4月, 2008 1 次提交
  25. 01 4月, 2008 1 次提交
  26. 24 3月, 2008 1 次提交
  27. 18 1月, 2008 1 次提交
  28. 08 10月, 2007 1 次提交
  29. 17 9月, 2007 1 次提交
  30. 03 9月, 2006 1 次提交
  31. 19 3月, 2006 1 次提交
  32. 06 3月, 2006 1 次提交
  33. 14 12月, 2004 1 次提交
  34. 13 12月, 2004 1 次提交
  35. 24 11月, 2004 1 次提交