1. 22 3月, 2012 6 次提交
    • 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
    • J
      Avoid obscure &Proc.new thing · fd68bd23
      Jon Leighton 提交于
      fd68bd23
    • J
      Remove valid_scope_name? check - use ruby · f6db31ec
      Jon Leighton 提交于
      scope is syntactic sugar for defining a class method. Ruby allows
      redefining methods but emits a warning when run with -w. So let's
      not implement our own logic for this. Users should run with -w if they
      want to be warned about redefined methods.
      f6db31ec
    • J
      no need for cast · 884e5b75
      Jon Leighton 提交于
      884e5b75
    • J
      no need for lvar · 7c1275a0
      Jon Leighton 提交于
      7c1275a0
    • A
      split subscribers based on pattern type · d99c790f
      Aaron Patterson 提交于
      d99c790f
  2. 21 3月, 2012 8 次提交
  3. 20 3月, 2012 7 次提交
  4. 19 3月, 2012 8 次提交
  5. 18 3月, 2012 11 次提交