| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| |
| |
| |
| |
| |
| | |
neerajdotname/delete_all_should_not_call_callbacks
Do not invoke callbacks when delete_all is called
Conflicts:
activerecord/CHANGELOG.md
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Method `delete_all` should not be invoking callbacks and this
feature was deprecated in Rails 4.0. This is being removed.
`delete_all` will continue to honor the `:dependent` option. However
if `:dependent` value is `:destroy` then the default deletion
strategy for that collection will be applied.
User can also force a deletion strategy by passing parameter to
`delete_all`. For example you can do `@post.comments.delete_all(:nullify)`
|
| |
| |
| |
| | |
Calling default_scope without a proc will now raise `ArgumentError`.
|
| | |
|
| |
| |
| |
| |
| | |
Deprecated options `delete_sql`, `insert_sql`, `finder_sql` and `counter_sql`
have been deleted.
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
Removed deprecated methods `partial_updates`, `partial_updates?` and
`partial_updates=`
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | | |
Removed deprecated scoped method
Conflicts:
activerecord/CHANGELOG.md
|
| |/ |
|
|/ |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For example:
class Post < ActiveRecord::Base
default_scope -> { where published: true }
end
class Comment
belongs_to :post
end
When calling `Comment.join(:post)`, we expect to receive only
comments on published posts, since that is the default scope for
posts.
Before this change, the default scope from `Post` was not applied,
so we'd get comments on unpublished posts.
|
|
|
|
| |
They were deprecated in 4.0, planned to remove in 4.1
|
|
|
|
| |
[ci skip]
|
| |
|
|\
| |
| |
| | |
When .find_each is called without a block, return an Enumerator.
|
| |
| |
| |
| | |
This lets us do things like call: .find_each.with_index
|
|\ \
| | |
| | |
| | | |
Change Result#each to return an Enumerator when called without a block.
|
| | |
| | |
| | |
| | | |
As with #10992, this lets us call #with_index, etc on the results.
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
fixes #10669
While joining_values special treatment is given to string values.
By flattening the array it ensures that string values are detected
as strings and not arrays.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
currently `post.comments.find(Comment.first.id)` would load all
comments for the given post to set the inverse association.
This has a huge performance penalty. Because if post has 100k
records and all these 100k records would be loaded in memory
even though the comment id was supplied.
Fix is to use in-memory records only if loaded? is true. Otherwise
load the records using full sql.
Fixes #10509
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This reverts commit 2b817a5e89ac0e7aeb894a40ae7151a0cf3cef16, reversing
changes made to 353a398bee68c5ea99d76ac7601de0a5fef6f4a5.
Conflicts:
activerecord/CHANGELOG.md
Reason: the build broke
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
If I have a query that produces sql
`WHERE "users"."name" = 'a b'` then in the log all the
whitespace is being squeezed. So the sql that is printed in the
log is `WHERE "users"."name" = 'a b'`.
This can be confusing. This commit fixes it by ensuring that
whitespace is not squeezed.
fixes #10982
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
currently `post.comments.find(Comment.first.id)` would load all
comments for the given post to set the inverse association.
This has a huge performance penalty. Because if post has 100k
records and all these 100k records would be loaded in memory
even though the comment id was supplied.
Fix is to use in-memory records only if loaded? is true. Otherwise
load the records using full sql.
Fixes #10509
|
| |
| |
| |
| | |
b483a0d2a75b
|
|/
|
|
| |
the changelog.
|
|
|
|
|
|
|
|
| |
As you can also configure your database connection using `ENV["DATABASE_URL"]`,
the fixture setup can't reply on the `.configurations` Hash.
As the fixtures are only loaded when ActiveRecord is actually used
(`rails/test_help.rb`) it should be safe to drop the check for an existing configuration.
|
| |
|
| |
|
|\
| |
| |
| |
| | |
Conflicts:
guides/source/upgrading_ruby_on_rails.md
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
For example, you need to change this:
class Author < ActiveRecord::Base
has_many :posts
has_many :taggings, :through => :posts
end
class Post < ActiveRecord::Base
has_one :tagging
has_many :taggings
end
class Tagging < ActiveRecord::Base
end
To this:
class Author < ActiveRecord::Base
has_many :posts
has_many :taggings, :through => :posts, :source => :tagging
end
class Post < ActiveRecord::Base
has_one :tagging
has_many :taggings
end
class Tagging < ActiveRecord::Base
end
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
of using +inverse_of: false+ option. Changing the documentation and
adding a CHANGELOG entry for the automatic inverse detection feature.
|
| |
| |
| |
| |
| |
| | |
When then PostgreSQL visitor was [added](https://github.com/rails/rails/commit/6b7fdf3bf3675a14eae74acc5241089308153a34)
`add_column` was no longer receiving the column options directly. This
caused the options to be lost along the way.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When removing records from a `has_many` association it used
the `primary_key` defined on the association.
Our test suite didn't fail because on all occurences of `:primary_key`,
the specified column was available in both tables. This prevented the
code from raising an exception but it still behaved badly.
I added a test-case to prevent regressions that failed with:
```
1) Error:
HasManyAssociationsTest#test_has_many_assignment_with_custom_primary_key:
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: essays.first_name: UPDATE "essays" SET "writer_id" = NULL WHERE "essays"."writer_id" = ? AND "essays"."first_name" IS NULL
```
|
|/ |
|
| |
|
|
|
|
| |
since 9.1.
|
|
|
|
|
|
| |
Deprecate SchemaStatements#distinct, and make SchemaStatements#columns_for_distinct nodoc.
Conflicts:
activerecord/CHANGELOG.md
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Call assume_migrated_upto_version on connection to prevent it from first
being picked up in method_missing. In the base class, Migration,
method_missing expects the argument to be a table name, and calls
proper_table_name on the arguments before sending to connection. If
table_name_prefix or table_name_suffix is used, the schema version changes
to prefix_version_suffix, breaking `rake test:prepare`.
Fixes #10411.
|
| |
|