| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Closes #5202 and #919
|
|\
| |
| | |
Removes caching from ActiveRecord::Core::ClassMethods#relation
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The #relation method gets called in four places and the return value was instantly cloned in three of them. The only place that did not clone was ActiveRecord::Scoping::Default::ClassMethods#unscoped. This introduced a bug described in #5667 and should really clone the relation, too. This means all four places would clone the relation, so it doesn't make a lot of sense caching it in the first place.
The four places with calls to relations are:
activerecord/lib/active_record/scoping/default.rb:110:in `block in build_default_scope'"
activerecord/lib/active_record/scoping/default.rb:42:in `unscoped'"
activerecord/lib/active_record/scoping/named.rb:38:in `scoped'"
activerecord/lib/active_record/scoping/named.rb:52:in `scope_attributes'"
|
| | |
|
|\ \
| | |
| | | |
Updated/changed unneeded tr/gsubs
|
| |/ |
|
|\ \
| | |
| | |
| | |
| | | |
Conflicts:
guides/source/engines.textile
|
| |/ |
|
| | |
|
|/ |
|
| |
|
| |
|
|\
| |
| | |
Fix deleting from a HABTM join table upon destroying an object of a model with optimistic locking enabled.
|
| |
| |
| |
| | |
with optimistic locking enabled. Issue #5332.
|
| | |
|
|\ \
| | |
| | | |
Nested attribute setters can be overridden.
|
| | |
| | |
| | |
| | | |
Overriding implementation can call super.
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
|\ \ \
| |/ /
|/| | |
Possibly clearer way of getting rid of ` and "
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Incidentally it's also faster...
>> a = 'hello "id` world'; Benchmark.realtime { 500_000.times { a.tr('`"', "") } }
=> 0.7388770580291748
>> a = 'hello "id` world'; Benchmark.realtime { 500_000.times { a.gsub(/[`"]/, "") } }
=> 1.7843739986419678
|
| | | |
|
| | | |
|
| | | |
|
|\ \ \ |
|
| | | |
| | | |
| | | | |
(and changed the use of true for a more database agnostic example).
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
Remove "needless boolean casting"
|
| |/ / /
| | | |
| | | |
| | | |
| | | | |
"Predicates in Rails rely on standard Ruby semantics for boolean values
and guarantee no singletons whatsoever." - @fxn
|
|\ \ \ \
| | | | |
| | | | | |
Issue with schema dump
|
| | | | | |
|
| |\ \ \ \ |
|
| | | | | | |
|
| | | | | | |
|
| |_|/ / /
|/| | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
closes #2737
Conflicts:
activerecord/lib/active_record/coders/yaml_column.rb
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Conflicts:
guides/source/ruby_on_rails_guides_guidelines.textile
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
particular usecase for this feature (to allow you to use inheritance in ActiveRecord without using the STI table name
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
week ago" to "more recently than a week ago."
|
| | | | | | |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Don't use this:
scope :red, where(color: 'red')
default_scope where(color: 'red')
Use this:
scope :red, -> { where(color: 'red') }
default_scope { where(color: 'red') }
The former has numerous issues. It is a common newbie gotcha to do
the following:
scope :recent, where(published_at: Time.now - 2.weeks)
Or a more subtle variant:
scope :recent, -> { where(published_at: Time.now - 2.weeks) }
scope :recent_red, recent.where(color: 'red')
Eager scopes are also very complex to implement within Active
Record, and there are still bugs. For example, the following does
not do what you expect:
scope :remove_conditions, except(:where)
where(...).remove_conditions # => still has conditions
|
| | | | | | |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
scope is syntactic sugar for defining a class method. Ruby allows
redefining methods but emits a warning when run with -w. So let's
not implement our own logic for this. Users should run with -w if they
want to be warned about redefined methods.
|
| | | | | | |
|
|/ / / / / |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Autosave association doesn't save all records on a new record for a collection association if there are records marked for destruction
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
destroy record in autosave collection.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Fix GH #5435. db:structure:dump should be re-enable.
|