| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
[fixes #18606]
Make belongs_to use touch over touch_later when running the callbacks.
Add more tests and small method rename
Thanks Jeremy for the feedback.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
https://github.com/ruby/ruby/pull/579 - there is a new optimization
since ruby 2.2
Previously regexp patterns were faster (since a string was converted to
regexp underneath anyway). But now string patterns are faster and
better reflect the purpose.
Benchmark.ips do |bm|
bm.report('regexp') { 'this is ::a random string'.gsub(/::/, '/') }
bm.report('string') { 'this is ::a random string'.gsub('::', '/') }
bm.compare!
end
# string: 753724.4 i/s
# regexp: 501443.1 i/s - 1.50x slower
|
|
|
|
| |
Deprecate `required` option in favor of `optional` for belongs_to.
|
|
|
|
| |
Fixes #18696.
|
| |
|
|
|
|
|
|
|
| |
To be possible to use a custom column name to save/read the polymorphic
associated type in a has_many or has_one polymorphic association, now users
can use the option :foreign_type to inform in what column the associated object
type will be saved.
|
| |
|
| |
|
| |
|
|
|
| |
This option is unused, left over from pre-1.0 Rails to internally distinguish the location of the foreign key.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In addition to defining the association, a `required` association will
also have its presence validated.
Before:
```ruby
belongs_to :account
validates_presence_of :account
```
After:
```ruby
belongs_to :account, required: true
```
This helps to draw a distinction between types of validations, since
validations on associations are generally for data integrity purposes,
and aren't usually set through form inputs.
|
|\
| |
| |
| |
| |
| |
| |
| |
| | |
Fix bug, when ':dependent => :destroy' violates foreign key constraints
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/associations/builder/association.rb
activerecord/lib/active_record/associations/builder/has_one.rb
|
| |
| |
| |
| | |
constraints, issue #12380
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
namespaced model
Now the following case will work fine
class Tag < ActiveRecord::Base
end
class Publisher::Article < ActiveRecord::Base
has_and_belongs_to_many :tags
end
Fixes #15761
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fix habtm reflection
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/counter_cache.rb
activerecord/lib/active_record/reflection.rb
activerecord/test/cases/reflection_test.rb
|
| | |
|
| |
| |
| |
| | |
Fixes #14824.
|
| |
| |
| |
| |
| |
| | |
cc:
https://github.com/rails/rails/commit/a11e2fcff8cdc9691b977d8330abe63024f8c732#commitcomment-6353614
and 0369dbf
|
| | |
|
| |
| |
| |
| |
| | |
parent_name is a string of nil, never a blank string so we don't need to
use presence.
|
| |
| |
| |
| |
| |
| | |
Thank's for @laurocaetano for the help with tests. :smiley:
Fixes #14709
|
| |
| |
| |
| |
| |
| | |
When used a custom join_table name on a habtm, rails was not saving it
on Reflections. This causes a problem when rails loads fixtures, because
it uses the reflections to set database with fixtures.
|
| | |
|
| |
| |
| |
| | |
destroy
|
| |
| |
| |
| | |
create
|
| | |
|
| |
| |
| |
| |
| | |
Dangerous association names conflicts include instance or class
methods already defined by `ActiveRecord::Base`.
|
| |
| |
| |
| | |
Fixes: #13445
|
| | |
|
| |
| |
| |
| |
| | |
activerecord-deprecated_finders expects the parameters denormalized in
its initialize method
|
| |
| |
| |
| | |
This is to get activerecord-deprecated_finders work again
|
| |
| |
| |
| | |
It is need in activerecord-deprecated_finders
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Example: Given you have a comments model with a polymorphic commentable
association (e.g. books and songs) with the touch option set.
Every time you update a comment its commentable should be touched.
This was working when you changed attributes on the comment or when you
moved the comment from one book to another. However, it was not working
when moving a comment from a book to a song. This is now fixed.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Previously, the `has_one` macro incorrectly accepts the `counter_cache` option
due to a bug, although that options was never supported nor functional on
`has_one` and `has_one ... through` relationships. It now correctly raises an
`ArgumentError` when passed that option.
For reference, this bug was introduced in 52f8e4b9.
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Renamed generated_feature_methods to generated_association_methods.
Conflicts:
activerecord/lib/active_record/associations/builder/association.rb
activerecord/lib/active_record/associations/builder/singular_association.rb
activerecord/test/cases/base_test.rb
|
| |/ |
|
| | |
|
| |
| |
| |
| |
| | |
All the job can be done at class level so we can avoid some object
allocation
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| | |
instance
|
| | |
|
| |
| |
| |
| | |
the instance
|
| | |
|