| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes the following behaviour:
class Person < ActiveRecord::Base
belongs_to :company
end
# Before:
person = Person.select('id').first
person[:name] # => nil
person.name # => ActiveModel::MissingAttributeError: missing_attribute: name
person[:company_id] # => nil
person.company # => nil
# After:
person = Person.select('id').first
person[:name] # => ActiveModel::MissingAttributeError: missing_attribute: name
person.name # => ActiveModel::MissingAttributeError: missing_attribute: name
person[:company_id] # => ActiveModel::MissingAttributeError: missing_attribute: company_id
person.company # => ActiveModel::MissingAttributeError: missing_attribute: company_id
Fixes #5433.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 86c3dfbd47cb96af02daaa655963292b1a1b110e.
Conflicts:
activerecord/lib/active_record/attribute_methods/read.rb
Reason: whilst this increased performance, it also presents a DoS risk
via memory exhaustion if users were allowing user input to dictate the
arguments of read/write_attribute. I will investigate alternative ways
to cut down on string allocations here.
|
|
|
|
|
| |
All tests with a custom inheritance_column use the `Vegtable` model.
The field ruby_type on the Company models is no longer needed
|
|
|
|
|
|
|
|
| |
This is a performance/GC optimisation.
In theory, this could be optimised by the implementation (last time I
checked, this would have no effect on JRuby). But in practise, this make
attribute access faster.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
It doesn't serve much purpose now that ActiveRecord::Base.all returns a
Relation.
The code is moved to active_record_deprecated_finders.
|
| |
|
|
|
|
|
| |
All other multiparameter assignment tests are in the same file, so it
makes sense to have all of them here.
|
|
|
|
| |
does not have TIME data type.
|
|
|
|
| |
SQLite3 driver to correctly generate a time column instead of datetime
|
| |
|
|
|
|
| |
things
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
require model"
This reverts commit 7381596ea32aff47222af89e4bc66000f4597acb.
|
| |
|
| |
|
| |
|
|
|
|
| |
#write_attribute are overridden
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
We also need to time zone convert time zone aware attributes when
accessed via read_attribute, not only when via direct access.
|
|
|
|
| |
This makes me happy!
|
| |
|
| |
|
|
|
|
|
|
|
| |
Implement a mini state machine for serialized attributes. This means we
do not have to deserialize the values upon initialization, which means
that if we never actually access the attribute, we never have to
deserialize it.
|
| |
|
|
|
|
|
|
|
| |
"Returns true if the specified attribute has been set by the user or by
a database load and is neither nil nor empty?"
Fixes #1613
|
|
|
|
|
|
|
|
|
| |
There is no meaningful performance penalty in defining attribute
methods, since it only happens once.
There is also no reason *not* to define them, since they get thrown in
an included module, so they will not 'overwrite' anything. In fact, this
is desirable, since it allows us to call super.
|
|
|
|
|
|
| |
This shouldn't ever happen unless people are doing something
particularly weird, but adding a deprecation in case there are bugs not
caught by our tests.
|
|
|
|
|
|
| |
Check respond_to_without_attributes? in method_missing. If there is any
method that responds (even private), let super handle it and raise
NoMethodError if necessary.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes a situation I encountered where a subclass would cache the
name of a generated attribute method in @_defined_class_methods. Then,
when the superclass has it's attribute methods undefined, the subclass
would always have to dispatch through method_missing, because the
presence of the attribute in @_defined_class_methods would mean that it
is never generated again, even if undefine_attribute_methods is called
on the subclass.
There various other confusing edge cases like this. STI classes share
columns, so let's just keep all the attribute method generation state
isolated to the base class.
|
|
|
|
|
| |
This reverts commit 87152f2604e73b218df90befda576f0acfed0bbf, reversing
changes made to 0d3615f04c79f6e90d8ab33fdfc920b8faac9cb8.
|
| |
|
| |
|
| |
|
|
|
|
| |
RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
|
| |
|
| |
|
| |
|