1. 30 6月, 2013 1 次提交
    • N
      Do not invoke callbacks when delete_all is called · f319e4a9
      Neeraj Singh 提交于
      Method `delete_all` should not be invoking callbacks and this
      feature was deprecated in Rails 4.0. This is being removed.
      `delete_all` will continue to honor the `:dependent` option. However
      if `:dependent` value is `:destroy` then the default deletion
      strategy for that collection will be applied.
      
      User can also force a deletion strategy by passing parameter to
      `delete_all`. For example you can do `@post.comments.delete_all(:nullify)`
      f319e4a9
  2. 20 7月, 2012 1 次提交
  3. 26 4月, 2012 1 次提交
  4. 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
  5. 09 9月, 2011 1 次提交
  6. 06 9月, 2011 1 次提交
  7. 13 5月, 2011 1 次提交
  8. 11 5月, 2011 1 次提交
  9. 19 4月, 2011 1 次提交
  10. 13 4月, 2011 1 次提交
  11. 19 9月, 2010 1 次提交
  12. 05 9月, 2010 1 次提交
    • N
      order should always be concatenated. · 91fec0d2
      Neeraj Singh 提交于
      order that is declared first has highest priority in all cases.
      
      Here are some examples.
      
      Car.order('name desc').find(:first, :order => 'id').name
      
      Car.named_scope_with_order.named_scope_with_another_order
      
      Car.order('id DESC').scoping do
        Car.find(:first, :order => 'id asc')
      end
      
      No special treatment to with_scope or scoping.
      
      Also note that if default_scope declares an order then the order
      declared in default_scope has the highest priority unless
      with_exclusive_scope is used.
      Signed-off-by: NSantiago Pastorino <santiago@wyeworks.com>
      91fec0d2
  13. 20 8月, 2010 1 次提交
  14. 14 8月, 2010 1 次提交
  15. 13 8月, 2010 1 次提交
  16. 09 7月, 2010 1 次提交