| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | | |
|
| | | |
|
|/ /
| |
| |
| |
| | |
See `ConnectionUrlResolver#database_from_path` in
`activerecord/lib/active_record/connection_adapters/connection_specification.rb`
|
| | |
|
| |
| |
| |
| | |
Closes #32885.
|
|\ \
| | |
| | | |
Use Turbolinks in Rails guides
|
| | | |
|
| | | |
|
|\ \ \
| | | |
| | | | |
Add hooks to ActiveJob around retries and discards
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
Refactor Active Record configurations
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
While the three-tier config makes it easier to define databases for
multiple database applications, it quickly became clear to offer full
support for multiple databases we need to change the way the connections
hash was handled.
A three-tier config means that when Rails needed to choose a default
configuration (in the case a user doesn't ask for a specific
configuration) it wasn't clear to Rails which the default was. I
[bandaid fixed this so the rake tasks could work](#32271) but that fix
wasn't correct because it actually doubled up the configuration hashes.
Instead of attemping to manipulate the hashes @tenderlove and I decided
that it made more sense if we converted the hashes to objects so we can
easily ask those object questions. In a three tier config like this:
```
development:
primary:
database: "my_primary_db"
animals:
database; "my_animals_db"
```
We end up with an object like this:
```
@configurations=[
#<ActiveRecord::DatabaseConfigurations::HashConfig:0x00007fd1acbded10
@env_name="development",@spec_name="primary",
@config={"adapter"=>"sqlite3", "database"=>"db/development.sqlite3"}>,
#<ActiveRecord::DatabaseConfigurations::HashConfig:0x00007fd1acbdea90
@env_name="development",@spec_name="animals",
@config={"adapter"=>"sqlite3", "database"=>"db/development.sqlite3"}>
]>
```
The configurations setter takes the database configuration set by your
application and turns them into an
`ActiveRecord::DatabaseConfigurations` object that has one getter -
`@configurations` which is an array of all the database objects.
The configurations getter returns this object by default since it acts
like a hash in most of the cases we need. For example if you need to
access the default `development` database we can simply request it as we
did before:
```
ActiveRecord::Base.configurations["development"]
```
This will return primary development database configuration hash:
```
{ "database" => "my_primary_db" }
```
Internally all of Active Record has been converted to use the new
objects. I've built this to be backwards compatible but allow for
accessing the hash if needed for a deprecation period. To get the
original hash instead of the object you can either add `to_h` on the
configurations call or pass `legacy: true` to `configurations.
```
ActiveRecord::Base.configurations.to_h
=> { "development => { "database" => "my_primary_db" } }
ActiveRecord::Base.configurations(legacy: true)
=> { "development => { "database" => "my_primary_db" } }
```
The new configurations object allows us to iterate over the Active
Record configurations without losing the known environment or
specification name for that configuration. You can also select all the
configs for an env or env and spec. With this we can always ask
any object what environment it belongs to:
```
db_configs = ActiveRecord::Base.configurations.configurations_for("development")
=> #<ActiveRecord::DatabaseConfigurations:0x00007fd1acbdf800
@configurations=[
#<ActiveRecord::DatabaseConfigurations::HashConfig:0x00007fd1acbded10
@env_name="development",@spec_name="primary",
@config={"adapter"=>"sqlite3", "database"=>"db/development.sqlite3"}>,
#<ActiveRecord::DatabaseConfigurations::HashConfig:0x00007fd1acbdea90
@env_name="development",@spec_name="animals",
@config={"adapter"=>"sqlite3", "database"=>"db/development.sqlite3"}>
]>
db_config.env_name
=> "development"
db_config.spec_name
=> "primary"
db_config.config
=> { "adapter"=>"sqlite3", "database"=>"db/development.sqlite3" }
```
The configurations object is more flexible than the configurations hash
and will allow us to build on top of the connection management in order
to add support for primary/replica connections, sharding, and
constructing queries for associations that live in multiple databases.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Context https://github.com/rails/rails/pull/33605#discussion_r210354278
Related to #32937, #33605
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | | |
"Configuring Rails Applications" guide [ci skip]
Related to #32937, #33605.
|
|\ \ \ \
| | | | |
| | | | | |
Add "Ruby on Rails 6.0 Release Notes" guide [ci skip]
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This commit adds a skeleton of "Ruby on Rails 6.0 Release Notes".
It isn't a good time to add changelogs' entries to this guide since we can
redo/revert some things till the final release 6.0.
It would be better to do it close to the release.
But we already can add mentions about major features
that have been added to 6.0. I added mention about "Parallel Testing".
|
|/ / / /
| | | |
| | | |
| | | | |
Edges Guides is now available in HTTPS, it would be better to use the HTTPS protocol directly.
|
|/ / / |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This commit is the next work after #33523.
Also, this commit removes mention about hidden `utf8` input. Since
form helpers don't generate this input by default since #32125.
Note that I also had created PR #31972 with improvements to
"Action View Form Helpers" guide, but I'll rebase it after merging the
current PR.
|
|\ \ \
| | | |
| | | | |
[ci skip] change all instances of blacklist and whitelist to denylist…
|
| | | |
| | | |
| | | |
| | | | |
restricted list and consistently use permitted
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
allowlist
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
allowlist
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
* Include form_with in form_helpers rails guide
* Include form_tag and form_for footnote
* Id and class attributes are not wrapped anymore
* Include note that all form_with forms are remote:true by default
* Underline most common use case of form_with is with arguments
* Form_with no longer accepts multiple hashes in form helper calls
* Review final sections
* Revert extra documentation
* Remove unnecessary link
|
|\ \ \ \
| | | | |
| | | | | |
Added explanation about new_framework_defaults.rb file [ci skip]
|
| | | | | |
|
| | | | | |
|
|/ / / /
| | | |
| | | |
| | | | |
https://github.com/rails/rails/issues/31190
|
|/ / / |
|
| | |
| | |
| | |
| | |
| | | |
In order to run ActiveStorage's tests successfully, you need
imagemagick.
|
| | | |
|
|\ \ \
| | | |
| | | | |
Update guide to mention code linters available
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Contributors can run RuboCop locally to catch code style error in Ruby
code and npm lint task for `rails-ujs` CoffeeScript and JavaScript code.
[skip ci]
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The sentence "This is exactly the same as defining a class method ..."
is not true, so #33653 fixed it, but added changes repeat what is explained
a few lines below. We can remove this part since a user is able to get info
about the difference between scopes and class methods below.
Context https://github.com/rails/rails/pull/33653#discussion_r211105969.
Reverts #33653, 97feb4996b1c88f770101dfce6d4d3a6baf6bb33.
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
Explained difference between scope & class method
|
| | | | | |
|
|/ / / /
| | | |
| | | |
| | | | |
Now requires version 1.11 or newer. Ref: bf5f41d948b6f3f27db7fdc2b70897aec991065f
|
| | | |
| | | |
| | | |
| | | | |
To prevent style check in review like https://github.com/rails/rails/pull/33608#discussion_r211087605.
|
| | | |
| | | |
| | | |
| | | | |
Fix a layout issue in the rails guides, where the navigation covers the main text,
if the page is between 800 and 960 pixels wide. (issue #33406)
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
ZASMan/update_action_mailer_docs_custom_view_paths
Add note for custom mailer view paths in action mailer guide. [ci skip]
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Adds stuff
Fixes a typo
Integrates changes
Adds link to append_view_path in actionmailer guide.
|
| |/ / /
|/| | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The method removes and returns the elements for which the block returns a true value.
If no block is given, an Enumerator is returned instead.
```
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9]
numbers # => [0, 2, 4, 6, 8]
```
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
- Name rails app' files relatively to its root
- `structure.sql` => `db/structure.sql`
- `schema.rb` => `db/schema.rb`
- Clarify rails commands
- `db:migrate` => `rails db:migrate`
- `db:migrate:status` => `rails db:migrate:status`
- Add `/` to the end of `db/migrate` in order to express that it is
directory and to keep consistency with `db/migrate/` above.
Follow up #33474
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Context https://github.com/rails/rails/pull/33563#discussion_r208891486.
Follow up #33563
|
|\ \ \ \
| | | | |
| | | | | |
Document best practices with old migrations
|