Commit Graph

7619 Commits

Author SHA1 Message Date
Baoshuo Ren
95253b2582
chore: remove git.io
see: https://github.blog/changelog/2022-04-25-git-io-deprecation/
2022-04-26 21:01:32 +08:00
Eileen M. Uchitelle
8ff748b32f
Merge pull request #44935 from dorianmariefr/patch-1
Updates --skip-git option description to be more accurate
2022-04-25 16:37:14 -04:00
Dorian Marié
1be896a12c
Updates --skip-git option description to be more accurate
It skips git init, .gitignore and .gitattributes not only .gitignore
2022-04-22 16:39:35 +02:00
Xavier Noria
e3f54144d8 Register the interlock hook only if reloading
If reloading is enabled, we need the interlock to synchronize reloads.

If reloading is disabled and so is eager loading, in the past you still needed
to synchronize autoloads because `classic` was not thread-safe. With Zeitwerk,
this is no longer needed.
2022-04-15 12:57:35 +02:00
Xavier Noria
cbfe735c69 Deprecate config.enable_dependency_loading 2022-04-14 22:31:26 +02:00
Xavier Noria
2953ae5c8a Define config.enable_reloading to be !config.cache_classes
Every time I write `config.cache_classes` I have to pause for a moment to make
sure I get it right. It makes you think.

On the other hand, if you read `config.enable_reloading = true`, does the
application reload? You do not need to spend 1 cycle of brain CPU to nod.
2022-04-14 18:11:36 +02:00
Xavier Noria
9fb131cb39 Move misplaced conditional 2022-04-13 15:58:36 +02:00
Xavier Noria
73f306a4bb Eager load after reload, if enabled
Fixes #24819
2022-04-12 19:54:53 +02:00
Aaron Patterson
cfa7284789
Merge pull request #44826 from stefkin/acp-eql-flag
Add a flag to disable deprecated AC::Parameters comparison
2022-04-04 09:09:44 -07:00
eileencodes
ad52c0a197
Remove legacy_connection_handling
This functionality has been deprecated since Rails 6.1 and can now be
removed. I've deleted all code, docs, references, and tests related to
this feature.
2022-04-04 09:36:13 -04:00
Seva Stefkin
67762c2407
Add a flag to disable deprecated AC::Parameters comparison 2022-04-04 10:08:05 +02:00
Gannon McGibbon
dfd0c9e5bd
Merge pull request #44717 from duduribeiro/add-js-dependencies-setup-when-not-using-importmaps
Add yarn install into bin/setup when not using importmap
2022-03-28 15:34:17 -04:00
Cadu Ribeiro
155b7570fa Add yarn install into bin/setup when not using importmap
After af7428c4acd0fcf9eed5c7215856594a078f23b7 the yarn install
instructions was dropped from bin/setup. This commmit adds it into
the setup script again if the user is not using importmap.
2022-03-28 15:50:28 -03:00
Gannon McGibbon
d38ed8bf0d
Merge pull request #44781 from ghousemohamed/added-missing-session-store-to-docs
Added missing `config.session_store` option `:cache_store` to docs [ci-skip]
2022-03-28 14:22:24 -04:00
Ghouse Mohamed
f5a79cc197 Added missing config.session_store option to docs 2022-03-28 19:17:16 +05:30
Rafael Mendonça França
af0733a8e7
Make sure respond_to? and method_missing works in abstract Railties
Those methods were raising an confusing exception when trying to call
`Rails::Railtie.respond_to?(:something)`. Now they just work.

Fixes #44761
2022-03-25 23:56:34 +00:00
Ghouse Mohamed
d5257887da Removed code which sets host! in console mode as it is not needed 2022-03-23 02:59:52 +05:30
Xavier Noria
7d87086f10 Reset current scopes in AR using an on_unload callback
Rails 6.0 and Rails 6.1 didn't support the undocumented `before_remove_const` in
`zeitwerk` mode. I noticed this cleanup in AR was not being executed, and
restored the original code for Rails 7.

However, invoking `respond_to?` in an `on_unload` callback may have unexpected
side-effects, as seen in #44125. So, this patch reimplements the cleanup in a
more modern way.

Fixes #44125.
2022-03-20 21:41:08 +01:00
Rafael Mendonça França
5c1bd20f0d
Merge pull request #44693 from ghousemohamed/fix-docs-related-gem-versions
Fix `#version` method docs and some typos [ci-skip]
2022-03-15 16:28:07 -04:00
Ghouse Mohamed
6ee6cb554b Fix #version docs and some typos 2022-03-16 01:48:37 +05:30
Hartley McGuire
1faf619813 remove extra core_ext/object/blank requires
activerecord/lib/active_record/connection_adapters/postgresql/column.rb
- usage added in 64fd666
- unneeded because of active_support/rails: 8f58d6e

railties/lib/rails/rack/logger.rb
- usage added in c83d9a1
- usage removed in c131211

activesupport/lib/active_support/number_helper/number_converter.rb
- the NumberHelper was split into multiple classes in 2da9d67, however
  the require was left in NumberConverter even though
  NumberToPhoneConverter is the only class where it's used

activesupport/lib/active_support/duration/iso8601_serializer.rb
- usage added in 04c512d
- usage removed in 51e991f
2022-03-14 21:58:10 -04:00
Andrew White
7f5b3e04c8
Use controller_class_path in NamedBase#route_url
The `route_url` method now returns the correct path when generating
a namespaced controller with a top-level model using `--model-name`.

Fixes #44662.
2022-03-12 09:45:10 +00:00
Breno Gazzola
c744439631 Do not remove assets initializer when using propshaft 2022-03-04 14:43:29 -03:00
Rafael Mendonça França
e3353e53c9
Merge pull request #44495 from Edouard-chin/ec-integration-test-inspect
Don't output the whole Rails::Railtie object when a NoMethodError is raised
2022-03-01 23:31:17 -05:00
Aaron Patterson
ea9f0103fd
Revert "Revert "Merge pull request #42843 from buckley-w-david/message-verifier-default-serializer""
This reverts commit fd4e63cc28863b9d1b7cca2da80bb0b1e879c2d3.
2022-03-01 15:14:43 -08:00
Aaron Patterson
fd4e63cc28
Revert "Merge pull request #42843 from buckley-w-david/message-verifier-default-serializer"
This reverts commit a40d7815ac92c3d24a7e0fab9a4f487860937ec7, reversing
changes made to ad2529be4b5942b6f38ab83b9796e1976685edca.
2022-03-01 13:58:40 -08:00
Saba Kiaei
5256c90327 Switch ActiveSupport::MessageVerifier's default serialization to JSON 2022-03-01 13:02:17 -05:00
Edouard CHIN
e60dd826c0 Don't output the whole Rails::Railtie object
- ### Summary

  The terminal output on a Rails application running ruby 3 will be
  cluttered with thousands of lines if one inadventarly call a
  unexisting method.
  This happen in various places (IntegrationTest, when running a db
  migration ...).
  This is related to a change in ruby 3 when a NoMethodError is
  raised.

  ### Simple reproduction

  ```
  class A
    def initialize(session)
      @a = session
    end
  end

  test = A.new("*" * 36)
  test.dsad # undefined method `dsad' for #<A:0x00007f847d8494b0 @a="************************************"> (NoMethodError)
  # Note that the "#<A:0x00007f847d8494b0 @a="************************************">" part
  # is 65 chars long.

  test = test = A.new("*" * 37)
  test.dsad # undefined method `dsad' for #<A:0x00007fa8c38299c0> (NoMethodError)
  ```

  On Ruby < 3, the NoMethodError message (everything starting from the
  "#" char) could only be 65 characters long. If it was above that
  ruby would only output the name of the class and its address.

  On Ruby >= 3, that limitation has been removed and the message can
  be any length long.

  ### On Rails

  Anytime a method is called on a object that holds the entire
  Rails::Application, the terminal would output the entire application
  which is annoying be can be dangerous because it will leak
  everything containing the credentials (stored inside the Application
  object).
2022-02-28 20:27:07 +01:00
Rafael Mendonça França
fec53a141a
Merge pull request #44488 from p8/railties/csp-initializer-copy
Correct CSP initializer copy
2022-02-25 15:43:06 -05:00
John Hawthorn
0a44c3f90b
Merge pull request #44454 from jhawthorn/rack_logger_finish_with_state
Use finish_with_state inside Rack::Logger
2022-02-24 15:24:55 -08:00
Eileen M. Uchitelle
be4b9057bb
Merge pull request #44504 from sanjioh/fix-typos
Fix some typos
2022-02-23 16:58:06 -05:00
Jonathan Hefner
497ab719d0
Merge pull request #44509 from jonathanhefner/apidocs-cross-link-docs
Cross-link API docs [ci-skip]
2022-02-23 12:08:41 -06:00
Jonathan Hefner
840ecf1e96
Merge pull request #44508 from jonathanhefner/apidocs-format-application-booting-process
Fix formatting of "Booting process" section [ci-skip]
2022-02-23 12:07:56 -06:00
Hartley McGuire
67b9347c16 use git init -b in generator when supported
This has the benefit of hiding the warning message from git when
initialBranch configuration is unset, and was a recommendation on the
original commit adding main as the default branch for generators.

Ref: eb261937ac856100b4e1c8a2dbb56aab6e5d140e
2022-02-22 11:05:46 -05:00
Petrik
ba3ff2def8 Improve CSP initializer copy
The `content_security_policy_report_only` config does not enable
violation reporting.
It makes sure the policy isn't enforced, only reported.

Also link to the guide instead of external documentation.
2022-02-21 21:14:34 +01:00
Jonathan Hefner
a199aaedb8 Cross-link API docs [ci-skip]
RDoc will automatically format and link API references as long as they
are not already marked up as inline code.

This commit removes markup from various API references so that those
references will link to the relevant API docs.
2022-02-21 11:45:25 -06:00
Jonathan Hefner
fe3fc94eb0 Fix formatting of "Booting process" section [ci-skip]
Rendering the list of boot steps as a code block confused the syntax
highlighter.

This commit changes the list to use RDoc's ordered list syntax, and adds
inline code markup as appropriate.
2022-02-21 11:45:19 -06:00
Jonathan Hefner
a801aa7cde Mark up inline code [ci-skip] 2022-02-21 11:11:11 -06:00
Jonathan Hefner
e37adfed4e Add Oxford commas [ci-skip] 2022-02-21 11:11:11 -06:00
Jonathan Hefner
5fdbd217d1 Fix typos [ci-skip] 2022-02-21 11:11:11 -06:00
Fabio Sangiovanni
6e30c183b6 Fix some typos. 2022-02-21 17:58:23 +01:00
Matthew Draper
ad0f0e6980 Be explicit every time we invoke 'rails'
This almost never matters, but if the path-global 'rake' or 'rails'
points to a specific (and wrong) ruby version, (or, possible in CI,
there is no installed 'rails' executable), things get confused.

Instead, any time we mean "run a global 'rails', as for 'new'", use a
fully-qualified path to our in-tree copy. And any time we're working
inside an application, use the bin/rails script directly. It would be
equivalently valid to always use the one in exe/, because that handles
searching for bin/rails internally... but it's uglier to fully-qualify,
plus 'rake' would then be more complicated.
2022-02-22 00:54:10 +10:30
Eddie Lebow
935cc1b10c
Document horo variables in RDoc configuration
https://github.com/zzak/sdoc/blob/master/lib/rdoc/generator/template/rails/class.rhtml
2022-02-18 16:45:21 -05:00
Petrik
7118ebabbb Fix rdoc for session_store documentation [ci-skip]
Use + instead of ` for values to pass.
2022-02-17 19:12:16 +01:00
John Hawthorn
c8350cc723 Use finish_with_state inside Rack::Logger
This ensures that the finish instrumenter is sent to the same
subscribers that the initial request was sent to.

This solves an issue where in a threaded environment the dynamic
subscriptions from ActionDispatch::ServerTiming would cause a mismatch
in the number of subscriptions to a topic, which would pop too many
values off of the thread-local stacks, leading to invalid events being
sent to subscribers.

Fixes #44167
2022-02-16 16:31:28 -08:00
Petrik
7c7d0b5ef1 Document some methods in Application::Configuration [ci-skip]
The documentation was mostly copied from the configurations
guide.
2022-02-16 21:07:40 +01:00
Gannon McGibbon
965367e390
Merge pull request #44393 from Edouard-chin/ec-class-module-children
Add module/class nesting consistency on newly generated application:
2022-02-10 15:51:10 -05:00
Edouard CHIN
5875c68209 Add module/class nesting consistency on newly generated application:
- These two generated files are the only two that uses a compact style
  when defining a class, (it's not the case for their non-test
  counterpart i.e. 0f3642596f/railties/lib/rails/generators/rails/app/templates/app/channels/application_cable/connection.rb.tt (L1-L2)).

  This fixes that to add some consistency and will avoid users using
  rubocop with the `Style/ClassAndModuleChildren: nested` rule to have
  to manually edit those files when generating a new app.
2022-02-10 20:02:36 +01:00
Rafael Mendonça França
de7c495209
Merge pull request #44354 from rails/to-fs-as-the-primary
Make #to_fs the default replacement for #to_s(:format)
2022-02-08 11:50:24 -05:00
Zack
5d0c2b0dd2 Change MessageEncryptor default serializer to JSON for Rails 7.1
These changes include adding a hybrid serializer class
named JsonWithMarshalFallback in order for existing apps
to have an upgrade path from Marshal to JSON.
2022-02-07 12:19:36 -05:00