| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
FIXTURES_PATH has a bit different case than DatabaseTasks.fixtures_path,
which was added along with deprecation. A use case for FIXTURES_PATH
could be loading fixtures from a different directory just for a given
test run. The implementation is fairly simple, so leaving it as it is
won't hurt.
|
|\
| |
| | |
Extract db url connection logic to class
|
| | |
|
|/
|
|
| |
argument
|
| |
|
|\
| |
| | |
Copy changed_attributes across to newly become'd records
|
| |
| |
| | |
Without this, the original record's values won't get saved, since the partial insertions support (https://github.com/rails/rails/commit/144e8691cbfb8bba77f18cfe68d5e7fd48887f5e) checks for changed values and thinks there are none.
|
| |
| |
| |
| |
| |
| | |
Warning:
DEPRECATION WARNING: Passing a string to ActiveRecord::Base.establish_connection for a configuration lookup is deprecated, please pass a symbol (:development) instead.
|
| |
| |
| |
| |
| |
| |
| | |
Warning:
~/projects/rails/activerecord/lib/active_record/railtie.rb:140: warning: method redefined; discarding old extend_message
~/projects/rails/activerecord/lib/active_record/errors.rb:104: warning: previous definition of extend_message was here
|
|\ \
| |/
|/| |
Typo rectified commom => common[ci skip]
|
| | |
|
| |
| |
| | |
Building on the work of #13427 this PR adds a helpful error message to the adapters: mysql, mysql2, and sqlite3
|
| | |
|
| | |
|
| | |
|
|\ \
| | |
| | | |
Do not store production information in .yml files
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This commit also cleans up the rake tasks that were checking
for DATABASE_URL in different places.
In fact, it would be nice to deprecate DATABASE_URL usage in the long
term, considering the direction we are moving of allowing those in .yml
files.
|
| | |
| | |
| | |
| | |
| | | |
Always pass in the column for quote_bound_value and quote using it in
case it exists there.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Fixes #12261. Closes #12395.
Conflicts:
activerecord/CHANGELOG.md
activerecord/test/cases/adapters/postgresql/array_test.rb
activerecord/test/cases/adapters/postgresql/json_test.rb
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The code uses these checks in several places to know what to do with a
particular column, for instance AR attribute query methods has a branch
like this:
if column.number?
!value.zero?
end
This should never be true for array columns, since it would be the same
as running [].zero?, which results in a NoMethodError exception.
Fixing this by ensuring that array columns in PostgreSQL never return
true for number?/text? checks.
Since most of the array support was based on the postgres_ext lib, it's
worth noting it does the same thing for numeric array columns too:
https://github.com/dockyard/postgres_ext/blob/v1.0.0/lib/postgres_ext/active_record/connection_adapters/postgres_adapter.rb#L72
This extended the same logic for text columns to ensure consistency.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently if you attempt to use a database that does not exist you get an error:
```
PG::ConnectionBad FATAL: database "db_error" does not exist
```
The solution is easy, create and migrate your database however new developers may not know these commands by memory. Instead of requiring the developer to search for a solution, tell them how to fix the problem in the error message:
```
ActiveRecord::NoDatabase: FATAL: database "db_error" does not exist
Run `$ bin/rake db:create db:migrate` to create your database
```
Active Record should not know about `rake db:migrate` so this additional information needs to come from the railtie. Potential alternative implementation suggestions are welcome.
|
| | |
|
| |
| |
| |
| | |
Fixes: #13445
|
| |
| |
| |
| | |
Closes #13444
|
| | |
|
| | |
|
|\ \
| | |
| | | |
fix CollectionAssociation's comments
|
| | |
| | |
| | |
| | | |
AssociationProxy to match changes for 3.1 removing Association proxy.
|
|\ \ \
| | | |
| | | | |
quoting: Check if id is a valid method before using it
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Need to check if valud also respond_to :id before calling it, otherwise
things could explode.
|
|/ / / |
|
|\ \ \ |
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
modified regex for finding table_name from a multiline sql query in postgresql
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Previously, executing an insert SQL in PostgreSQL with a command like this:
insert into articles(
number)
values(
5152
)
would not work because the adapter was unable to extract the correct articles table name.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
fix typos and grammar mistake [ci skip]
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Assigning nil to a polymorphic belongs_to would nullify its _id field by
not its _type field.
Fixes failing test from c141dfc838a5dca9f197814410fa5d44c143129c.
Regression from 1678e959e973de32287b65c52ebc6cce87148951.
|
|\ \ \ \ \ \
| |_|/ / / /
|/| | | | | |
#none documentation updated [ci skip]
|
| | | | | | |
|
| | | | | | |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
This change was necessary because the whitelist wouldn't work.
It would be painful for users trying to update their applications.
This blacklist intent to prevent odd bugs and confusion in code that call mutator
methods directely on the `Relation`.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Blast from the past, MySQL 4 era, when the password hashing style changed.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Using the name of an association in `where` previously worked only
if the value was a single `ActiveRecrd::Base` object. e.g.
Post.where(author: Author.first)
Any other values, including `nil`, would cause invalid SQL to be
generated. This change supports arguments in the `where` query
conditions where the key is a `belongs_to` association name and the
value is `nil`, an `Array` of `ActiveRecord::Base` objects, or an
`ActiveRecord::Relation` object.
# Given the Post model
class Post < ActiveRecord::Base
belongs_to :author
end
# nil value finds records where the association is not set
Post.where(author: nil)
# SELECT "posts".* FROM "posts" WHERE "posts"."author_id" IS NULL
# Array values find records where the association foreign key
# matches the ids of the passed ActiveRecord models, resulting
# in the same query as Post.where(author_id: [1,2])
authors_array = [Author.find(1), Author.find(2)]
Post.where(author: authors_array)
# ActiveRecord::Relation values find records using the same
# query as Post.where(author_id: Author.where(last_name: "Emde"))
Post.where(author: Author.where(last_name: "Emde"))
Polymorphic `belongs_to` associations will continue to be handled
appropriately, with the polymorphic `association_type` field added
to the query to match the base class of the value. This feature
previously only worked when the value was a single `ActveRecord::Base`.
class Post < ActiveRecord::Base
belongs_to :author, polymorphic: true
end
Post.where(author: Author.where(last_name: "Emde"))
# Generates a query similar to:
Post.where(author_id: Author.where(last_name: "Emde"), author_type: "Author")
|
| | | | | | |
|
|\| | | | |
| | | | | |
| | | | | | |
Spelling and Grammar check [ci skip]
|
| | | | | | |
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
support creating temporary tables from queries
Conflicts:
activerecord/CHANGELOG.md
|