Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Dec 7, 2012
  1. Carlos Antonio da Silva

    Unscope update_column(s) query to ignore default scope

    carlosantoniodasilva authored
    When applying default_scope to a class with a where clause, using
    update_column(s) could generate a query that would not properly update
    the record due to the where clause from the default_scope being applied
    to the update query.
    
        class User < ActiveRecord::Base
          default_scope where(active: true)
        end
    
        user = User.first
        user.active = false
        user.save!
    
        user.update_column(:active, true) # => false
    
    In this situation we want to skip the default_scope clause and just
    update the record based on the primary key. With this change:
    
        user.update_column(:active, true) # => true
    
    Backport of #8436 fix.
    
    Conflicts:
    	activerecord/CHANGELOG.md
    	activerecord/lib/active_record/persistence.rb
    	activerecord/test/cases/persistence_test.rb
Commits on Oct 31, 2012
  1. Aliaxandr Rahalevich
Commits on Oct 29, 2012
  1. Carlos Antonio da Silva Rafael Mendonça França

    Merge pull request #8053 from henrik/update_columns_with_primary_key

    carlosantoniodasilva authored rafaelfranca committed
    Unbreak update_column/update_columns for the primary key attribute.
    Conflicts:
    	activerecord/CHANGELOG.md
    	activerecord/lib/active_record/persistence.rb
    	activerecord/test/cases/persistence_test.rb
Commits on Sep 3, 2012
  1. Yves Senn

    set the configured #inheritance_column on #become (#7503)

    senny authored senny committed
    I had to create a new table because I needed an STI table,
    which does not have both a "type" and a "custom_type"
    
    the test fails with:
      1) Error:
    test_alt_becomes_works_with_sti(InheritanceTest):
    NoMethodError: undefined method `type=' for #<Cabbage id: 1, name: "my cucumber", custom_type: "Cucumber">
        /Users/username/Projects/rails/activemodel/lib/active_model/attribute_methods.rb:432:in `method_missing'
        /Users/username/Projects/rails/activerecord/lib/active_record/attribute_methods.rb:100:in `method_missing'
        /Users/username/Projects/rails/activerecord/lib/active_record/persistence.rb:165:in `becomes'
        test/cases/inheritance_test.rb:134:in `test_becomes_works_with_sti'
        test/cases/inheritance_test.rb:140:in `test_alt_becomes_works_with_sti'
    
    Conflicts:
    
    	activerecord/test/cases/inheritance_test.rb
Commits on Aug 15, 2012
  1. Rafael Mendonça França

    Do not use update_column where update_attribute is not interchangeable

    rafaelfranca authored
    Revert "Deprecate update_attribute."
    
    This reverts commit b081f6b.
    
    Reason: Since the new deprecation policy we removed the deprecation of
    update_attribute but we didn't reverted the changes to use
    update_column.
    
    Fixes #7306
Commits on Aug 1, 2012
  1. Xavier Noria

    removes the deprecation of update_attribute

    fxn authored
    Applying the new policy here to not deprecate stuff in point releases.
  2. Xavier Noria

    revises the deprecation warning of update_attribute

    fxn authored
    We have decided not to drop this important method in 4.0 and give
    it a longer deprecation cycle. On the other hand we do not expect
    to have update_column around for a long time, it is going to be
    replaced in favor of update_columns.
Commits on Jul 30, 2012
  1. Rafael Mendonça França

    Revert "Add update_columns and the suggestion of using update_columns

    rafaelfranca authored
    instead of update_column"
    
    This reverts commit 9fa06c3.
    
    This reverts commit 17a64de.
    
    This reverts commit def9c85, reversing
    changes made to 6b7d26c.
    
    Reason: This was supposed to be released with 3.2.7 before the
    suggestion to use update_column. Since it was not release now is not
    good to suggest to use another method because it will confusing the
    people.
Commits on Jul 25, 2012
  1. Philip Arndt

    Suggest using update_columns instead of update_column.

    parndt authored
    update_column is deprecated in Rails 4.0 so it makes no sense to
    recommend adopting it only to require changing to update_columns
    in the very next release.
  2. Sebastian Martinez Philip Arndt

    New #update_columns method.

    smartinez87 authored parndt committed
Commits on Jun 14, 2012
  1. Steve Klabnik

    Deprecate update_attribute.

    steveklabnik authored
    Historically, update_attribute and update_attributes are similar, but
    with one big difference: update_attribute does not run validations.
    These two methods are really easy to confuse given their similar
    names. Therefore, update_attribute is being deprecated in favor of
    update_column, and will be removed in Rails 4.
    
    See the discussion on rails-core here:
    https://groups.google.com/d/topic/rubyonrails-core/BWPUTK7WvYA/discussion
Commits on Dec 22, 2011
  1. Jon Leighton
Commits on Dec 15, 2011
  1. Jon Leighton
Commits on Nov 16, 2011
  1. James Adam

    `ActiveRecord::Base#becomes` should retain the errors of the original…

    lazyatom authored
    … object.
    
    This commit contains a simple failing test that demonstrates the behaviour we expect, and a fix. When using `becomes` to transform the type of an object, it should retain any error information that was present on the original instance.
Commits on Oct 5, 2011
  1. Jon Leighton

    Revert "Raise error on unknown primary key."

    jonleighton authored
    This reverts commit ee2be43.
  2. Jon Leighton

    Raise error on unknown primary key.

    jonleighton authored
    If we don't have a primary key when we ask for it, it's better to fail
    fast. Fixes GH #2307.
Commits on Sep 12, 2011
  1. Jon Leighton

    Raise error when using write_attribute with a non-existent attribute.

    jonleighton authored
    Previously we would just silently write the attribute. This can lead to
    subtle bugs (for example, see the change in AutosaveAssociation where a
    through association would wrongly gain an attribute.
    
    Also, ensuring that we never gain any new attributes after
    initialization will allow me to reduce our dependence on method_missing.
Commits on Aug 8, 2011
  1. Jon Leighton

    Make it the responsibility of the connection to hold onto an ARel vis…

    jonleighton authored
    …itor for generating SQL. This improves the code architecture generally, and solves some problems with marshalling. Adapter authors please take note: you now need to define an Adapter.visitor_for method, but it degrades gracefully with a deprecation warning for now.
Commits on Jul 24, 2011
  1. John Kelleher

    Fixed Typo

    John authored jpkcambridge committed
Commits on Jul 8, 2011
  1. Jon Leighton

    Destroy association habtm record before destroying the record itself.…

    Tomas D'Stefano authored jonleighton committed
    … Fixes issue #402.
Commits on Jun 28, 2011
  1. Aaron Patterson
Commits on Jun 7, 2011
  1. Dmitriy Kiriyenko Jon Leighton
Commits on May 25, 2011
  1. Xavier Noria

    Merge branch 'master' of git://github.com/lifo/docrails

    fxn authored
    Conflicts:
    	actionmailer/lib/action_mailer/base.rb
    	activesupport/lib/active_support/core_ext/kernel/requires.rb
Commits on May 24, 2011
  1. Aaron Patterson
Commits on May 21, 2011
  1. Sebastian Martinez
Commits on May 8, 2011
  1. Josh Kalderimis
Commits on Apr 29, 2011
  1. Aaron Patterson
Commits on Apr 26, 2011
  1. Sebastian Martinez
  2. Josh Kalderimis
Commits on Mar 28, 2011
  1. Sebastian Martinez Santiago Pastorino

    Added new #update_column method.

    smartinez87 authored spastorino committed
    Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Commits on Mar 27, 2011
  1. Sebastian Martinez Santiago Pastorino

    Revert "Removed #update_attribute method. New #update_column method."

    smartinez87 authored spastorino committed
    This reverts commit 45c233e.
    
    Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Commits on Mar 26, 2011
  1. Sebastian Martinez Santiago Pastorino

    Removed #update_attribute method. New #update_column method.

    smartinez87 authored spastorino committed
    Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Commits on Mar 22, 2011
  1. Aaron Patterson
Commits on Feb 15, 2011
  1. Emilio Tagua

    Merge remote branch 'rails/master' into identity_map

    miloops authored
    Conflicts:
    	activerecord/examples/performance.rb
    	activerecord/lib/active_record/association_preload.rb
    	activerecord/lib/active_record/associations.rb
    	activerecord/lib/active_record/associations/association_proxy.rb
    	activerecord/lib/active_record/autosave_association.rb
    	activerecord/lib/active_record/base.rb
    	activerecord/lib/active_record/nested_attributes.rb
    	activerecord/test/cases/relations_test.rb
Commits on Feb 9, 2011
  1. Josh Kalderimis

    removed some duplication from LH issue 5505 regarding AR touch and op…

    joshk authored Santiago Pastorino and José Ignacio Costa committed
    …timistic locking [#5505 state:resolved]
    
    Signed-off-by: Santiago Pastorino and José Ignacio Costa <santiago+jose@wyeworks.com>
Something went wrong with that request. Please try again.