| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Move some methods to the top to better organize them, since they're used
right at the beginning of the multiparameter assignment method chain.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Checking respond_to? incurs overhead, and most of the time when
assigning attributes it will return true. So just handle the
NoMethodError instead.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
SQLite3 driver to correctly generate a time column instead of datetime
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This feature adds a lot of complication to ActiveRecord for dubious
value. Let's talk about what it does currently:
class Customer < ActiveRecord::Base
composed_of :balance, :class_name => "Money", :mapping => %w(balance amount)
end
Instead, you can do something like this:
def balance
@balance ||= Money.new(value, currency)
end
def balance=(balance)
self[:value] = balance.value
self[:currency] = balance.currency
@balance = balance
end
Since that's fairly easy code to write, and doesn't need anything
extra from the framework, if you use composed_of today, you'll
have to add accessors/mutators like that.
Closes #1436
Closes #2084
Closes #3807
|
|
|
|
| |
config.active_record.mass_assignment_sanitizer=
|
| |
|
| |
|
|\
| |
| | |
Don't assign the attributes if the list is empty
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are two possible scenarios where the @mass_assignment_options
instance variable can become corrupted:
1. If the assign_attributes doesn't complete correctly, then
subsequent calls to a nested attribute assignment method will use
whatever options were passed to the previous assign_attributes call.
2. With nested assign_attributes calls, the inner call will overwrite
the current options. This will only affect nested attributes as the
attribute hash is sanitized before any methods are called.
To fix this we save the current options in a local variable and then
restore these options in an ensure block.
|