1. 03 8月, 2012 3 次提交
  2. 02 8月, 2012 8 次提交
    • J
      s/scoped/scope/ · b33e7ba1
      Jon Leighton 提交于
      b33e7ba1
    • J
      Add CollectionProxy#scope · 0e1cafcb
      Jon Leighton 提交于
      This can be used to get a Relation from an association.
      
      Previously we had a #scoped method, but we're deprecating that for
      AR::Base, so it doesn't make sense to have it here.
      
      This was requested by DHH, to facilitate code like this:
      
          Project.scope.order('created_at DESC').page(current_page).tagged_with(@tag).limit(5).scoping do
            @topics      = @project.topics.scope
            @todolists   = @project.todolists.scope
            @attachments = @project.attachments.scope
            @documents   = @project.documents.scope
          end
      0e1cafcb
    • J
      Use explicit delegations · 26d3e325
      Jon Leighton 提交于
      This makes it easier to see what the documentation refers to.
      
      It also means that we are not doing unnecessary work for delegations
      that have no args / splats / block / etc.
      26d3e325
    • J
      Refactor a bit · 66aaca4e
      Jon Leighton 提交于
      This doesn't change the exernal behavior, but it moves some code around
      to where I think it properly belongs.
      66aaca4e
    • J
      Add `Relation#load` · 437851ea
      Jon Leighton 提交于
      This method explicitly loads the records and then returns `self`.
      
      Rather than deciding between "do I want an array or a relation?",
      most people are actually asking themselves "do I want to eager load
      or lazy load?" Therefore, this method provides a way to explicitly
      eager-load without having to switch from a `Relation` to an array.
      
      Example:
      
          @posts = Post.where(published: true).load
      437851ea
    • J
      4efebded
    • J
      Revert "Remove :finder_sql, :counter_sql, :insert_sql, :delete_sql." · 7f3b4756
      Jon Leighton 提交于
      This reverts commit 3803fcce.
      
      Conflicts:
      	activerecord/CHANGELOG.md
      
      It will be deprecated only in 4.0, and removed properly in 4.1.
      7f3b4756
    • K
      Change AR's CHANGELOG, because it is related to e35c67ae · 79dc9220
      kennyj 提交于
      79dc9220
  3. 01 8月, 2012 3 次提交
  4. 31 7月, 2012 2 次提交
  5. 30 7月, 2012 2 次提交
  6. 29 7月, 2012 3 次提交
  7. 28 7月, 2012 7 次提交
  8. 27 7月, 2012 4 次提交
    • J
      ActiveRecord::Base.all returns a Relation. · 6a81ccd6
      Jon Leighton 提交于
      Previously it returned an Array.
      
      If you want an array, call e.g. `Post.to_a` rather than `Post.all`. This
      is more explicit.
      
      In most cases this should not break existing code, since
      Relations use method_missing to delegate unknown methods to #to_a
      anyway.
      6a81ccd6
    • R
      Only require the `:rails_env` task where is needed. · f1afd776
      Rafael Mendonça França 提交于
      `:rails_env` tasks is not needed in all the tasks that depends of
      `load_config`, only in the tasks that uses `Rails.env`.
      
      Since `:rails_env` task set the `Rails.env` to be "development" if it is
      not set we don't need the `||` statements too
      
      Fix #7175.
      
      Conflicts:
      	activerecord/lib/active_record/railties/databases.rake
      f1afd776
    • Y
      Modify the preference attribute from `:null => false` to `:null => true` · dab8ca53
      Yasuo Honda 提交于
      to address ORA-01400 errors with Oracle enhanced adapter.
      
      Issue #4856 had been fixed and tested with
      the attribute `:null => false, :default => ""`.
      Now `:null => false` attribute is not necessary to test this issue.
      dab8ca53
    • B
      Refactor ActiveRecord::Inheritance.base_class logic · d0aebd53
      beerlington 提交于
      Moved logic from class_of_active_record_descendant(class) to the
      base_class method. This method was confusing because it required
      an argument, but that argument was 'self'.
      
      Moved base_class tests to inheritance_test.rb and added some test
      coverage for some untested cases.
      d0aebd53
  9. 26 7月, 2012 5 次提交
  10. 25 7月, 2012 3 次提交