| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
| |
[ci skip]
This is due to the fact that `.delete` is directly translated to SQL.
It tries to follow the same rules as `.delete_all` which is not able
to verify that records are `#readonly?`.
|
|
|
|
|
|
| |
Since 3e30c5d, it started ignoring the given error message. This commit
changes the behavior of AR::RecordNotSaved#initialize so that it no
longer loses the given error message.
|
|
|
|
| |
This allows these exceptions to be handled generically in conjunction with RecordInvalid.
|
|
|
|
| |
Oh hey, we got to remove some code because of that!
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 8fee923888192a658d8823b31e77ed0683dfd665.
Conflicts:
activerecord/lib/active_record/attribute_set/builder.rb
This solution sucks, and is hard to actually apply across the board.
Going to try other solutions
|
|
|
|
|
|
|
| |
Currently, there is no messages which get printed out. Convoluted system
may have hooks that create other objects in which case we only fail with
no messages. This commit changes this information allowing you to know
which object is the one that actually raised the error.
|
|
|
|
|
|
|
| |
We introduced a performance hit by adding an additional iteration
through a model's attributes on creation. We don't actually need the
values from `Result` to be a hash, we can separate the columns and
values and zip them up ourself during the iteration that we have to do.
|
| |
|
| |
|
|
|
|
|
|
| |
`#create!` regarding validations in contrast to the behavior of
`#create`. Also describe creating multiple objects using an array of
hashes as the +attributes+ parameter. [ci skip] /cc #16384
|
|
|
|
| |
for rdoc
|
| |
|
| |
|
|
|
|
| |
This was used more previously, but other uses have been removed.
|
|
|
|
|
|
| |
`reload` is meant to put a record in the same state it would be if you
were to do `Post.find(post.id)`. This means we should fully replace the
attributes hash.
|
|
|
|
|
| |
Mostly delegation to start, but we can start moving a lot of behavior in
bulk to this object.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There's a lot more that can be moved to these, but this felt like a good
place to introduce the object. Plans are:
- Remove all knowledge of type casting from the columns, beyond a
reference to the cast_type
- Move type_cast_for_database to these objects
- Potentially make them mutable, introduce a state machine, and have
dirty checking handled here as well
- Move `attribute`, `decorate_attribute`, and anything else that
modifies types to mess with this object, not the columns hash
- Introduce a collection object to manage these, reduce allocations, and
not require serializing the types
|
|
|
|
|
|
|
| |
We never want result types to override column types, and
`decorate_columns` can only affect column types. No need to go through
the decoration multiple times, we can just exclude the column types from
the result types instead.
|
|
|
|
|
| |
Reduces the number of things outside of attribute methods that cares
about the details of how we store and type cast attributes
|
|
|
|
|
| |
`@raw_attributes` should not contain the type-cast, mutable version of
the value.
|
| |
|
|
|
|
|
|
|
|
|
| |
`@attributes` was actually used for `_before_type_cast` and friends,
while `@attributes_cache` is the type cast version (and caching is the
wrong word there, but I'm working on removing the conditionals around
that). I opted for `@raw_attributes`, because `_before_type_cast` is
also semantically misleading. The values in said hash are in the state
given by the form builder or database, so raw seemed to be a good word.
|
|
|
|
|
| |
Closes #15122
Closes #15107
|
|\
| |
| |
| | |
Renamed private methods _create_record and _update_record
|
| |
| |
| |
| |
| |
| | |
This is to ensure that they are not accidentally called by the app code.
They are renamed to _create_record and _update_record respectively.
Closes #11645
|
|\ \
| | |
| | |
| | | |
Still touch associations when theres no timestamp
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Prior to Rails 4.0.4 when touching a object which doesn't have timestamp
attributes (updated_at / updated_on) rails would still touch all
associations. After 73ba2c14cd7d7dfb2d132b18c47ade995401736f it updates
associations but rollsback because `touch` would return nil since
there's no timestamp attribute
|
| | | |
|
| | | |
|
|/ /
| |
| |
| |
| | |
As of https://github.com/rails/rails/pull/12031 after_commit and
after_rollback are also executed
|
| | |
|
|/
|
|
| |
Active Record is specifically for databases. Refs #12101.
|
|
|
|
|
|
| |
- fixes #13788
As per the documentation at lock!, if the :lock option is a string it should use the given SQL to generate the lock statement.
|
| |
|
| |
|
| |
|
|\
| |
| | |
Copy changed_attributes across to newly become'd records
|
| |
| |
| | |
Without this, the original record's values won't get saved, since the partial insertions support (https://github.com/rails/rails/commit/144e8691cbfb8bba77f18cfe68d5e7fd48887f5e) checks for changed values and thinks there are none.
|
|/ |
|
| |
|
| |
|
| |
|
|
|
|
| |
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.
|
|\ |
|