| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
skip]
|
|
|
|
| |
Make AM::Dirty less dirty to plugin into AR or other library
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* It is no longer true that options are passed to find.
* Documents that ActiveRecord::RecordNotFound may be raised.
* Documents that the reload happens in-place.
* Documents that caches are wiped.
* Documents that the method returns self.
* Documents a couple of use cases.
|
|\ |
|
| | |
|
| | |
|
| | |
|
|/
|
|
| |
This fixes issue #10066
|
| |
|
| |
|
|
|
|
|
| |
This allows end-users to have a `connection` method on their models
without clashing with ActiveRecord internals.
|
|\
| |
| | |
Added documentation to touch throwing an error
|
| |
| |
| |
| | |
to use it on an unpersisted object.
|
|\ \
| |/
|/| |
Changed update to use prepared statements
|
| | |
|
| |
| |
| |
| |
| | |
object that has not yet been persisted. This behavior follows the
precedent set by update_columns.
|
| |
| |
| |
| | |
with new transaction state. If AR object has a callback, the callback will be performed immediately (non-lazily) so the transaction still has to keep records with callbacks.
|
|/ |
|
|
|
|
|
|
|
|
| |
This revision makes crystal clear that the methods go
straight to the database and update the receiver. It
also adds and example, and removes the duplication
in the singular and plural forms by referring one to
the other.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
Fixes #8436.
|
|
|
|
| |
Inheritance#discriminate_class_for_record handle STI lookup duties.
|
|
|
|
|
|
|
|
| |
They was extracted from a plugin.
See https://github.com/rails/rails-observers
[Rafael Mendonça França + Steve Klabnik]
|
| |
|
| |
|
|
|
|
| |
If you want to change the STI type too, use AR::Base.becomes! instead
|
|\
| |
| |
| |
| |
| |
| | |
Conflicts:
actionpack/lib/action_controller/metal/mime_responds.rb
activerecord/lib/active_record/attribute_methods.rb
guides/source/working_with_javascript_in_rails.md
|
| |
| |
| |
| | |
to keep 'output' messages untouched.
|
|/
|
|
| |
Didn't work before because it updated the model-in-memory first, so the DB query couldn't find the record.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
When inserting new records, only the fields which have been changed
from the defaults will actually be included in the INSERT statement.
The other fields will be populated by the database.
This is more efficient, and also means that it will be safe to
remove database columns without getting subsequent errors in running
app processes (so long as the code in those processes doesn't
contain any references to the removed column).
|
|
|
|
| |
references to mass assignment options
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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'
|
| |
|
|
|
|
| |
This reverts commit 7a8aee08b610f6edbfe5be076dc14e5cdcf1355e.
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit a7f4b0a1231bf3c65db2ad4066da78c3da5ffb01.
Conflicts:
activerecord/lib/active_record/associations/has_one_association.rb
activerecord/lib/active_record/persistence.rb
activerecord/test/cases/base_test.rb
activerecord/test/cases/dirty_test.rb
activerecord/test/cases/timestamp_test.rb
|
|
|
|
|
|
|
|
|
|
| |
This method was added to be shared between update_attribute and
update_column in 50725cec397d4fa0ecf1dda4e6ae845a993f1ba7, but since
update_attribute was removed, and update_column has changed to delegate
to update_columns, the method is not used anywhere anymore.
Also remove "key.to_s" conversion when raising readonly error, since
the key is being interpolated.
|
| |
|
|
|
|
|
|
| |
update_column was suggested as replacement of update_attribute at the
last release of 3-2-stable, so deprecating it now will confuse the
users.
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 14fc8b34521f8354a17e50cd11fa3f809e423592.
Reason: we need to discuss a better path from this removal.
Conflicts:
activerecord/lib/active_record/reflection.rb
activerecord/test/cases/base_test.rb
activerecord/test/models/developer.rb
|
|
|
|
| |
Closes #1190
|
| |
|
| |
|