| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
Currently we sometimes find a redundant begin block in code review
(e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205).
I'd like to enable `Style/RedundantBegin` cop to avoid that, since
rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5
(https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with
that situation than before.
|
|
|
|
| |
There is no reason `attributes=` doesn't take `assign_attributes`.
|
|
|
|
| |
This was added in 9bfa13b, but it is never used from the beginning.
|
| |
|
|
|
|
|
| |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
| |
|
| |
|
|
|
|
|
|
| |
All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772.
But comments was still kept absolute position. This commit aligns
comments with method definitions for consistency.
|
| |
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|
|
|
|
|
|
|
| |
Ruby 2.4 unifies Fixnum and Bignum into Integer: https://bugs.ruby-lang.org/issues/12005
* Forward compat with new unified Integer class in Ruby 2.4+.
* Backward compat with separate Fixnum/Bignum in Ruby 2.2 & 2.3.
* Drops needless Fixnum distinction in docs, preferring Integer.
|
|
|
|
|
|
|
| |
- Corrects an incorrect exception message when using accepts_nested_attributes_for
- Removes rescue/reraise behavior introduced in #19077
- Adds has_many & has_one, nested_attributes test case specifying the message that
should be conveyed with an exception raised because one of the nested attributes provided is unknown
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The focus of this change is to make the API more accessible.
References to method and classes should be linked to make it easy to
navigate around.
This patch makes exzessiv use of `rdoc-ref:` to provide more readable
docs. This makes it possible to document `ActiveRecord::Base#save` even
though the method is within a separate module
`ActiveRecord::Persistence`. The goal here is to bring the API closer to
the actual code that you would write.
This commit only deals with Active Record. The other gems will be
updated accordingly but in different commits. The pass through Active
Record is not completely finished yet. A follow up commit will change
the spots I haven't yet had the time to update.
/cc @fxn
|
|
|
|
| |
fix minor problems
|
|
|
|
|
|
|
|
|
|
| |
The name `ActiveModel::AttributeAssignment::UnknownAttributeError` is
too implementation specific so let's move the constant directly under
the ActiveModel namespace.
Also since this constant used to be under the ActiveRecord namespace, to
make the upgrade path easier, let's avoid raising the former constant
when we deal with this error on the Active Record side.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows us to remove `Type::Value#klass`, as it was only used for
multi-parameter assignment to reach into the types internals. The
relevant type objects now accept a hash in addition to their previous
accepted arguments to `type_cast_from_user`. This required minor
modifications to the tests, since previously they were relying on the
fact that mulit-parameter assignement was reaching into the internals of
time zone aware attributes. In reaility, changing those properties at
runtime wouldn't change the accessor methods for all other forms of
assignment.
|
|
|
|
| |
It's under private in Active Model as well.
|
|
|
|
|
| |
Minor style changes across the board. Changed an alias to an explicit
method declaration, since the alias will not be documented otherwise.
|
|
|
|
|
|
| |
`ActiveModel::AttributesAssignment`
Allows to use it for any object as an includable module.
|
| |
|
|
|
|
|
| |
We still had one file using `column_for_attribute` when it could return
nil, causing deprecation warnings in the tests.
|
| |
|
|
|
|
|
| |
As we move towards removing the `klass` method from `column`, the else
clause as it stands right now will become the only case.
|
|\ |
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
| |
The `:timestamp` type for columns is unused. All database adapters treat
them as the same database type. All code in `ActiveRecord` which changes
its behavior based on the column's type acts the same in both cases.
However, when the type is passed to code that checks for the `:datetime`
type, but not `:timestamp` (such as XML serialization), the result is
unexpected behavior.
Existing schema definitions will continue to work, and the `timestamp`
type is transparently aliased to `datetime`.
|
| |
|
| |
|
|
|
|
|
|
| |
If you are passed an empty hash, then assign_attributes doesn't need to
do any work and can just return early. This should fix the failing Agile
Web Development tests.
|
|\
| |
| |
| |
| |
| |
| | |
Raising an error when nil is passed to update_attributes.
Conflicts:
activerecord/CHANGELOG.md
|
| | |
|
|/
|
|
| |
Rails 4.0 has removed attr_protected and attr_accessible feature in favor of Strong Parameters.
|
|
|
|
|
|
|
|
|
| |
begin
Topic.new("hello" => "world")
rescue ActiveRecord::UnknownAttributeError => e
e.record # => #<Topic ... >
e.attribute # => "hello"
end
|
| |
|
| |
|
|
|
|
|
|
|
| |
The Time.time_with_datetime_fallback, Time.utc_time and Time.local_time
methods were added to handle the limitations of Ruby's native Time
implementation. Those limitations no longer apply so we are deprecating
them in 4.0 and they will be removed in 4.1.
|
|
|
|
| |
attributes
|
| |
|
| |
|
| |
|
|
|
|
| |
or new protection model
|
| |
|
| |
|
|
|
|
|
| |
Cleans up a lot of noise from arguments being passed from one method to
another.
|
|
|
|
|
| |
This should make it easier to refactor and improve this code, and remove
complexity with params going around here and there.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Avoid doing a new column lookup for the attribute, since we already have
the column to check for the klass.
|