Commit Graph

81686 Commits

Author SHA1 Message Date
John Hawthorn
006a82b1ad
Merge pull request #43206 from rails/justin-case
Use an if statement instead of a case statement
2021-09-10 15:26:13 -07:00
Aaron Patterson
2c3ba1fb40
Use an if statement instead of a case statement
Case statement will create a jump table that isn't worth while when
there is only one value
2021-09-10 15:23:18 -07:00
Rafael França
a692e63bf4
Merge pull request #43188 from ceritium/asset-debugging-template-per-case
Fix flaky tests, add a template per case on asset debugging tests
2021-09-10 00:01:58 -04:00
Jose Galisteo
0063fb307a Add a template per case on asset debugging tests
It avoids the problem when the file checker is not able to detect changes
on the files during testing.
2021-09-09 22:36:12 +02:00
Ryuta Kamizono
cf99be46c9
Merge pull request #43192 from dylanahsmith/ar-relation-update-bang
Avoid scoping update transaction when calling update! on a relation
2021-09-10 02:27:34 +09:00
Dylan Thacker-Smith
de7ca90538 Avoid scoping update transaction when calling update! on a relation
This makes scoping consistent with ActiveRecord::Relation#update.
ActiveRecord::Relation#update was defined specifically to avoid this
unexpected scoping in Active Record callbacks triggered from the update
which otherwise get introduced by ActiveRecord::Relation#method_missing.
2021-09-09 12:09:03 -04:00
David Heinemeier Hansson
a8c4c27a81 Use the same description 2021-09-09 13:56:44 +02:00
David Heinemeier Hansson
b3cdb5154c Require by default for plugins too 2021-09-09 13:56:25 +02:00
David Heinemeier Hansson
80f6a5fd4d Style 2021-09-09 13:56:02 +02:00
David Heinemeier Hansson
837b0f9577 Turn on ruby/debug by default in dev + test
Then you can halt execution any time with binding.b.
2021-09-09 13:38:02 +02:00
Wojciech Wnętrzak
10467dbbb3
Mention Good Job as Active Job backend.
It's fully based on Rails, so not really possible to run in any other way.
Thanks to that it is simple, yet powerfull.
It's very well maintained and used in production systems by many people.

[ci skip]
2021-09-09 09:56:25 +02:00
Xavier Noria
df94beb8a3 Document upgrading instructions for Spring (again) 2021-09-09 01:59:17 +02:00
Xavier Noria
4cc69d732e Document upgrading instructions for Spring 2021-09-09 01:10:03 +02:00
Xavier Noria
7ffe204a08 Upgrade debug to 1.0.0 2021-09-08 20:33:22 +02:00
Xavier Noria
b9be4e1e31 Revise style 2021-09-08 18:21:21 +02:00
Xavier Noria
24956f2e5f
Merge pull request #43187 from rails/debug
Depend on ruby/debug, replacing Byebug
2021-09-08 17:50:00 +02:00
Xavier Noria
89801b2a43 Depend on ruby/debug, replacing Byebug
ruby/debug is a new debugger that is going to ship with CRuby.

It makes sense for Rails to switch to this one because that is
where the language is heading, and because Byebug is not fully
compatible with Zeitwerk. See

    https://github.com/deivid-rodriguez/byebug/issues/564

While ruby/debug has not been heavily tested with Zeitwerk,
casual usage seems to suggest it works without issues, including
explicit namespaces, which is where Byebug and Zeitwerk conflict.

Byebug is terrific, thanks a lot for all these years. ❤️
2021-09-08 17:35:41 +02:00
Anton Rieder
db286625d0
Don't show deprecation warning for equal paths
Before, if a user set `file_fixture_path` to the same path as
`fixture_path`, this would have resulted in a deprecation warning such
as:

"Please modify the call from `fixture_file_upload('rails.jpg')` to
`fixture_file_upload('rails.jpg')"
2021-09-08 11:45:19 +02:00
David Heinemeier Hansson
fa1a4b657c Let jsbundling-rails expand without requiring a change in Rails 2021-09-07 21:00:06 +02:00
David Heinemeier Hansson
83808166e6
Add --css app generator option (#43177)
* Add --css to preconfigure a CSS bundler/processor

* Simpler conditional

* Add CSS gems

* Test CSS options
2021-09-07 17:48:13 +02:00
Yasuo Honda
c344d61e3f Remove if current_adapter?(:PostgreSQLAdapter)
because Active Record `bin/test` only executes its own adapter tests.
Test files under `test/cases/adapters` directory does not have to
say `if current_adapter?` anymore.
2021-09-07 21:34:56 +09:00
Yasuo Honda
a3f1eb5ebe Active Record bin/test command runs only its own adapter tests
There are two ways to run unit tests. `bundle exec rake test` and
`bin/test`. Active Record `bundle exec rake test` only executes its
own adapter specific tests. on the other hand, `bin/test` executes all
adapter specfic tests then some test files need to have `if
current_adapter?`, which can be removed.

- Removed `require_relative "../../tools/test"` to require its own one
- `default_test_exclude_glob` excludes all of adapter specific tests.
- `list_tests(argv)` adds its own adapter specific tests
- `adapter_short` method extracted to get the short hand adapter name
  like `sqlite3`, `mysql2` and `postgresql` via `ENV["ARCONN"]`
2021-09-07 21:34:56 +09:00
Yasuo Honda
39b305c0b7 Extract list_tests from Rails::TestUnit::Runner.load_tests
This commit has been made for a future change
for Active Record bin/test to run its own database adapter related tests.
2021-09-07 21:34:56 +09:00
Jean Boussier
061bf3156f
Merge pull request #43148 from jbourassa/polymorphic-custom-name-fixes
Use `polymorphic_class_for` over `constantize`
2021-09-07 08:31:43 +02:00
Jimmy Bourassa
2ea5ff9e13
Use polymorphic_class_for over constantize
This commit fixes 2 cases where `constantize` was used instead of
of calling `polymorphic_class_for` to retrieve the class associated
with a given string for polymorphic `belongs_to`.
2021-09-06 17:16:43 -04:00
Ryuta Kamizono
e1f90a30a2
Merge pull request #43171 from yykamei/replace-location-with-request-in-process_action.action_controller
Replace :location with :request in process_action.action_controller

[ci-skip]
2021-09-07 05:04:38 +09:00
David Heinemeier Hansson
7595c922a6
Use the combined jsbundling-rails gem instead of individual js bundler gems (#43172)
* Use the combined jsbundling-rails gem instead of individual js bundler gems

* Remove Webpacker remnants

* Replace webpacker with jsbundling-rails
2021-09-06 16:44:44 +02:00
Jean Boussier
532ef0d13c Add back Lint/UselessAssignment
Fix: #43169
2021-09-06 16:24:37 +02:00
Yutaka Kamei
92ac51bf66
Replace :location with :request in process_action.action_controller
The payload of `process_action.action_controller` seems to be updated
via b5c6f33f0d
2021-09-06 22:31:32 +09:00
Jean Boussier
78e402077d
Merge pull request #43170 from byroot/rubocop-explicit-block-argument
Enable `Style/ExplicitBlockArgument` cop
2021-09-05 18:13:42 +02:00
Jean Boussier
c91c266872 Enable Style/ExplicitBlockArgument cop
This reduce the stack size which is beneficial for
exceptions performance.

See: https://gist.github.com/byroot/cb3bcadcc3701c2518d002fb8d3a4e7a

However the cop is unsafe because it might change the block arity,
so it can run into some false positives.
2021-09-05 17:06:19 +02:00
Jean Boussier
5fbc750840 Get rid of mattr_accessor in ActiveSupport::Dependencies
Since the module isn't included anywhere and is purely static
there iss no point using `mattr_accessor`, which define instance
accessors and other extra overhead.

Regular `attr_accessor` does the job just fine.
2021-09-05 12:42:23 +02:00
Xavier Noria
1d6355f6e1 Move Zeitwerk to railties
Active Support should not know about Rails. Once classic has been removed,
AS should get anything it needs from the application as usual.
2021-09-05 03:37:46 +02:00
Ryuta Kamizono
f967bce8a8
Merge pull request #43166 from ceritium/fix-rubocop-offense
Fix rubocop offense
2021-09-05 03:57:09 +09:00
Jose Galisteo
86ee45477c Fix rubocop offense 2021-09-04 20:48:35 +02:00
Xavier Noria
5346dfdf74 Move the default autoloaders inflector to railties 2021-09-04 20:44:39 +02:00
David Heinemeier Hansson
abc43f0448
Add rollup as JavaScript option (#43164) 2021-09-04 19:56:21 +02:00
David Heinemeier Hansson
abc042cf9e Fix trailing whitespace 2021-09-04 19:47:32 +02:00
David Heinemeier Hansson
82e4432058
Javascript generator option with choices (#43160)
* Switch to a single controller option for choosing JavaScript approach

* Remove remnants of webpacker specific work within Rails

* No longer used

* Missing space

* Raise if unknown option is passed

* Style

* Use latest versions

* Make channels setup generic to all node setups

* Make Action Text installer work with any node package manager

* Explaining variables are not useless

* Rubocop pleasing

* Don't rely on Rails.root

Tests don't like it!

* Rubocopping

* Assume importmap

* No longer relevant

* Another cop

* Style

* Correct installation notice

* Add dependencies for action cable when adding a channel

* Fix paths to be relative to generator

* Just go straight to yarn, forget about binstub

* Fix tests

* Fixup installer, only yarn once

* Test generically with run

* Style

* Fix reference and reversibility

* Style

* Fix test

* Test pinning dependencies

* Remove extra space

* Add more tests

* Use latest dependencies

* Relegated this to controllers

* Refactor ChannelGenerator + more tests

Use a uniform level of abstraction
2021-09-04 11:53:57 +02:00
Xavier Noria
0b15b7d59c More examples in the autoloading guide 2021-09-04 10:10:36 +02:00
Xavier Noria
43ff2bfef0 Autoloading notes in the upgrading guide 2021-09-04 09:54:26 +02:00
Xavier Noria
e0d77f124d Formatting 2021-09-04 09:32:04 +02:00
Xavier Noria
d9fc52cc7b Update the AS CHANGELOG 2021-09-04 09:30:08 +02:00
Ryuta Kamizono
b71d157b3f
Merge pull request #43158 from p8/guides/improve-configuring
Small improvements to the Configuring guide [ci-skip]
2021-09-04 15:08:30 +09:00
Xavier Noria
556572ac19 Fixes typo 2021-09-04 07:56:57 +02:00
Petrik
b403e48563 Small improvements to the Configuring guide [ci-skip]
Made things more consistent, added missing backticks and improved
sentences.

Co-authored-by: Ryuta Kamizono <kamipo@gmail.com>
2021-09-03 14:38:10 +02:00
Ryuta Kamizono
9c77d72ecc
Merge pull request #43159 from p8/guides/improve-active-storage-config-examples
Show Active Storage configs defaults as multiline code blocks [ci-skip]
2021-09-03 20:41:33 +09:00
Petrik
a80f1e3482 Show Active Storage configs defaults as multiline code blocks [ci-skip]
This makes it more readable and it is easier to copy the values.
2021-09-03 11:21:46 +02:00
Jonathan Hefner
a44fbb5dca
Merge pull request #43138 from p8/guides/use-headings-for-configuration-options
Use headings for configs in Configuration guide [ci-skip]
2021-09-02 15:03:24 -05:00
Petrik
fe27a22b7c Use headings for configs in Configuration guide [ci-skip]
The current configurations in the Configuration guide are described
using unordered lists. This can be error prone to formatting errors and
doesn't allow deeplinking to configuration options.

If we use headings instead we can deeplink to these options from other guides.
2021-09-02 21:49:32 +02:00