1. 30 1月, 2012 2 次提交
  2. 29 1月, 2012 1 次提交
  3. 28 1月, 2012 1 次提交
  4. 27 1月, 2012 2 次提交
  5. 26 1月, 2012 8 次提交
  6. 25 1月, 2012 3 次提交
    • P
      Handle nil in add_index :length option in MySQL · 6cde635f
      Paul Sadauskas 提交于
      Our schema.rb is being generated with an `add_index` line similar to this:
      
          add_index "foo", ["foo", "bar"], :name => "xxx", :length => {"foo"=>8, "bar=>nil}
      
      This is the same as it was on Rails 3.1.3, however, now when that
      schema.rb is evaluated, its generating bad SQL in MySQL:
      
          Mysql::Error: You have an error in your SQL syntax; check the manual
          that corresponds to your MySQL server version for the right syntax
          to use near '))' at line 1: CREATE UNIQUE INDEX
          `xxx` ON `foo` (`foo`(8), `bar`())
      
      This commit adds a check for nil on the length attribute to prevent the
      empty parens from being output.
      6cde635f
    • A
      deprecated AR::TestCase in favor of AS::TestCase · 6fe02f9a
      Aaron Patterson 提交于
      6fe02f9a
    • A
      Moving AR::TestCase in to the AR tests directory · dcf0558a
      Aaron Patterson 提交于
      dcf0558a
  7. 24 1月, 2012 2 次提交
  8. 23 1月, 2012 1 次提交
  9. 22 1月, 2012 1 次提交
  10. 21 1月, 2012 9 次提交
  11. 20 1月, 2012 5 次提交
  12. 19 1月, 2012 1 次提交
    • O
      Add ActiveRecord::Base#with_lock · 7afbc89c
      Olek Janiszewski 提交于
      Add a `with_lock` method to ActiveRecord objects, which starts
      a transaction, locks the object (pessimistically) and yields to the block.
      The method takes one (optional) parameter and passes it to `lock!`.
      
      Before:
      
          class Order < ActiveRecord::Base
            def cancel!
              transaction do
                lock!
                # ... cancelling logic
              end
            end
          end
      
      After:
      
          class Order < ActiveRecord::Base
            def cancel!
              with_lock do
                # ... cancelling logic
              end
            end
          end
      7afbc89c
  13. 18 1月, 2012 1 次提交
  14. 17 1月, 2012 3 次提交
    • E
      validate related records in the same validation context as parent. · 9b15e01c
      Emmanuel Oga 提交于
      E.G.:
      
      ```ruby
      class Parent < ActiveRecord::Base
        has_one :child
        validates_presence_of :name, :on => "custom_context"
        validates_associated :child
      end
      
      class Child < ActiveRecord::Base
        belongs_to :parent
        validates_presence_of :name, :on => "custom_context"
      end
      
      p = Parent.new(:name => "Montoto", :child => Child.new)
      p.valid?(:custom_context) # => Returns true, even though the child is not valid under the same context.
      ```
      9b15e01c
    • D
      Fix bug where reset_counters resets the wrong counter cache. · ee013a50
      David Peter 提交于
      If a model belongs_to two associations with the same class, then reset_counters
      will reset the wrong counter cache.
      
      Finding the right reflection should use the foreign_key instead, which should
      be unique.
      ee013a50
    • A
      stop more ddl changes · 21afd9b9
      Aaron Patterson 提交于
      21afd9b9