1. 13 9月, 2012 1 次提交
    • J
      Pass in the model class rather than engine · e55c75d2
      Jon Leighton 提交于
      In some circumstances engine was Arel::Table.engine which for separate
      reasons was an ActiveRecord::Model::DeprecationProxy, which caused a
      deprecation warning.
      
      In any case, we want the actual model class here, since we want to use
      it to infer information about associations.
      e55c75d2
  2. 12 9月, 2012 1 次提交
    • B
      Accept belongs_to assoc. keys in ActiveRecord queries · 3da275c4
      beerlington 提交于
      Allows you to specify the model association key in a belongs_to
      relationship instead of the foreign key.
      
      The following queries are now equivalent:
      
      Post.where(:author_id => Author.first)
      Post.where(:author => Author.first)
      
      PriceEstimate.where(:estimate_of_type => 'Treasure', :estimate_of_id => treasure)
      PriceEstimate.where(:estimate_of => treasure)
      3da275c4
  3. 24 8月, 2012 1 次提交
  4. 03 8月, 2012 1 次提交
  5. 31 7月, 2012 1 次提交
  6. 28 7月, 2012 3 次提交
  7. 22 7月, 2012 2 次提交
  8. 17 7月, 2012 5 次提交
  9. 14 7月, 2012 1 次提交
  10. 13 7月, 2012 1 次提交
  11. 08 7月, 2012 3 次提交
  12. 07 7月, 2012 3 次提交
  13. 06 7月, 2012 3 次提交
  14. 28 6月, 2012 1 次提交
  15. 26 6月, 2012 1 次提交
  16. 23 6月, 2012 1 次提交
  17. 22 6月, 2012 1 次提交
  18. 19 6月, 2012 1 次提交
    • S
      Removing composed_of from ActiveRecord. · 14fc8b34
      Steve Klabnik 提交于
      This feature adds a lot of complication to ActiveRecord for dubious
      value. Let's talk about what it does currently:
      
      class Customer < ActiveRecord::Base
        composed_of :balance, :class_name => "Money", :mapping => %w(balance amount)
      end
      
      Instead, you can do something like this:
      
          def balance
            @balance ||= Money.new(value, currency)
          end
      
          def balance=(balance)
            self[:value] = balance.value
            self[:currency] = balance.currency
            @balance = balance
          end
      
      Since that's fairly easy code to write, and doesn't need anything
      extra from the framework, if you use composed_of today, you'll
      have to add accessors/mutators like that.
      
      Closes #1436
      Closes #2084
      Closes #3807
      14fc8b34
  19. 18 6月, 2012 1 次提交
  20. 17 6月, 2012 3 次提交
  21. 01 6月, 2012 1 次提交
  22. 24 5月, 2012 1 次提交
    • V
      Revert "Remove blank trailing comments" · 1ad0b378
      Vijay Dev 提交于
      This reverts commit fa6d921e.
      
      Reason: Not a fan of such massive changes. We usually close such changes
      if made to Rails master as a pull request. Following the same principle
      here and reverting.
      
      [ci skip]
      1ad0b378
  23. 20 5月, 2012 1 次提交
    • H
      Remove blank trailing comments · fa6d921e
      Henrik Hodne 提交于
      For future reference, this is the regex I used: ^\s*#\s*\n(?!\s*#). Replace
      with the first match, and voilà! Note that the regex matches a little bit too
      much, so you probably want to `git add -i .` and go through every single diff
      to check if it actually should be changed.
      fa6d921e
  24. 17 5月, 2012 1 次提交
  25. 12 5月, 2012 1 次提交
    • J
      CollectionProxy < Relation · c86a32d7
      Jon Leighton 提交于
      This helps bring the interfaces of CollectionProxy and Relation closer
      together, and reduces the delegation backflips we need to perform.
      
      For example, first_or_create is defined thus:
      
      class ActiveRecord::Relation
        def first_or_create(...)
          first || create(...)
        end
      end
      
      If CollectionProxy < Relation, then post.comments.first_or_create will
      hit the association's #create method which will actually add the new record
      to the association, just as post.comments.create would.
      
      With the previous delegation, post.comments.first_or_create expands to
      post.comments.scoped.first_or_create, where post.comments.scoped has no
      knowledge of the association.
      c86a32d7