This switches wildcard dependencies from using its custom
find_all_with_query method to use all_template_paths, the same method
now used for DidYouMean template suggestions.
This also removes related cache for wildcard queries. Since it was only
used during digesting, the digest cache should be sufficient.
This removes FallbackFileSystemResolver, LookupContext#with_fallbacks,
and LookupContext.fallbacks.
These used to exist to support `render file:`, and rendering templates
outside of the defined view paths. `render file:` has since been changed
to not use template resolution, and to only render absolute paths.
These were no longer callable through any public API.
This reverts commit d2f4541f126001e029078cc48a3a481e23ae3ed9.
It should work without curly braces.
See also: #41198, #41206, 81d90d81d0ee1fc1a649ab705119a71f2d04c8a2.
Keyword argument warnings are caused by #41206 to allow both
`current_page?(url_hash)` and `current_page?(**url_hash)` on Ruby 3.0.
Unfortunately it is super hard to support that for both Ruby 2.7 and 3.0
with the same method signature.
Closes#41710.
Prior to this change, javascript_include_tag was sending a hint using
rel="preload" for all scripts, including those of type="module".
This causes the browser to make a request to preload the script, but
because the rel is incorrect, it won't be able to reuse it.
When passing type="module", it should use rel=modulepreload instead.
[0] developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content
[1] developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link
[2] developer.mozilla.org/en-US/docs/Web/HTML/Link_types/modulepreload
* Check for the presence of `formmethod` first before checking against
the GET/POST verbs;
* Use `match?` to avoid creating unnecessary match objects;
* Remove capture groups from the verb regexp.
Passing instance variables to `render` will be deprecated in the next
version, which is Rails 7.1.
Also add the non-deprecated implementation, which removes `@?` from the
Regexp, to make removal of the deprecation easier.
Rails partial rendering allows assigning instance variables.
For example:
render 'partial', :@name => "Maceo"
This sets @name to "Maceo" on the ActionView::Base object.
The allowed instance variables aren't restricted to the user's defined
instance variables but can also override private Rails variables like
@_assigns, @output_buffer, @_config, and @_default_form_builder.
When `name` is not specified, `phone_to` uses `phone_number` as the link
text. This commit allows options to be specified in such a case. This
enables using the `country_code` option to include the country code in
the link `href`, while a country-code-less `phone_number` is used as the
link text.
RDoc Markup does not support backticks the way Markdown does to mark up
inline code. Additionally, `<tt>` must be used to mark up inline code
that includes spaces or certain punctuation characters (e.g. quotes).
This pull request addresses the following warnings enabled since ruby/ruby#4070
* Warnings without this fix 1
```
% ruby -v
ruby 3.1.0dev (2021-02-01T10:54:21Z master 1cdae49d39) [x86_64-darwin20]
% bin/test test/cases/arel/visitors/sqlite_test.rb:36
... snip ...
/Users/yahonda/src/github.com/rails/rails/activerecord/test/cases/arel/support/fake_record.rb:98: warning: Passing only keyword arguments to Struct#initialize will behave differently from Ruby 3.2. Please use a Hash literal like .new({k: v}) instead of .new(k: v).
.
Finished in 0.003538s, 2261.1645 runs/s, 2543.8101 assertions/s.
8 runs, 9 assertions, 0 failures, 0 errors, 0 skips
%
```
* Warnings without this fix 2
```ruby
% ruby -v
ruby 3.1.0dev (2021-02-01T10:54:21Z master 1cdae49d39) [x86_64-darwin20]
% bin/test test/cases/type/adapter_specific_registry_test.rb
Using sqlite3
Run options: --seed 53175
......./Users/yahonda/src/github.com/rails/rails/activerecord/test/cases/type/adapter_specific_registry_test.rb:126: warning: Passing only keyword arguments to Struct#initialize will behave differently from Ruby 3.2. Please use a Hash literal like .new({k: v}) instead of .new(k: v).
/Users/yahonda/src/github.com/rails/rails/activemodel/lib/active_model/type/registry.rb:18: warning: Passing only keyword arguments to Struct#initialize will behave differently from Ruby 3.2. Please use a Hash literal like .new({k: v}) instead of .new(k: v).
/Users/yahonda/src/github.com/rails/rails/activerecord/test/cases/type/adapter_specific_registry_test.rb:130: warning: Passing only keyword arguments to Struct#initialize will behave differently from Ruby 3.2. Please use a Hash literal like .new({k: v}) instead of .new(k: v).
/Users/yahonda/src/github.com/rails/rails/activemodel/lib/active_model/type/registry.rb:18: warning: Passing only keyword arguments to Struct#initialize will behave differently from Ruby 3.2. Please use a Hash literal like .new({k: v}) instead of .new(k: v).
.../Users/yahonda/src/github.com/rails/rails/activerecord/test/cases/type/adapter_specific_registry_test.rb:85: warning: Passing only keyword arguments to Struct#initialize will behave differently from Ruby 3.2. Please use a Hash literal like .new({k: v}) instead of .new(k: v).
/Users/yahonda/src/github.com/rails/rails/activemodel/lib/active_model/type/registry.rb:18: warning: Passing only keyword arguments to Struct#initialize will behave differently from Ruby 3.2. Please use a Hash literal like .new({k: v}) instead of .new(k: v).
/Users/yahonda/src/github.com/rails/rails/activerecord/test/cases/type/adapter_specific_registry_test.rb:86: warning: Passing only keyword arguments to Struct#initialize will behave differently from Ruby 3.2. Please use a Hash literal like .new({k: v}) instead of .new(k: v).
/Users/yahonda/src/github.com/rails/rails/activemodel/lib/active_model/type/registry.rb:18: warning: Passing only keyword arguments to Struct#initialize will behave differently from Ruby 3.2. Please use a Hash literal like .new({k: v}) instead of .new(k: v).
.
Finished in 0.011424s, 962.8852 runs/s, 2450.9804 assertions/s.
11 runs, 28 assertions, 0 failures, 0 errors, 0 skips
%
```
* Warnings without this fix 3
```ruby
$ cd actionview
$ bin/test test/template/url_helper_test.rb
Run options: --seed 27105
........................../home/yahonda/src/github.com/rails/rails/actionview/test/template/url_helper_test.rb:88: warning: Passing only keyword arguments to Struct#initialize will behave differently from Ruby 3.2. Please use a Hash literal like .new({k: v}) instead of .new(k: v).
.............................../home/yahonda/src/github.com/rails/rails/actionview/test/template/url_helper_test.rb:94: warning: Passing only keyword arguments to Struct#initialize will behave differently from Ruby 3.2. Please use a Hash literal like .new({k: v}) instead of .new(k: v).
..................................................../home/yahonda/src/github.com/rails/rails/actionview/test/template/url_helper_test.rb:71: warning: Passing only keyword arguments to Struct#initialize will behave differently from Ruby 3.2. Please use a Hash literal like .new({k: v}) instead of .new(k: v).
......................
Finished in 0.305066s, 429.4159 runs/s, 580.2032 assertions/s.
131 runs, 177 assertions, 0 failures, 0 errors, 0 skips
$
```
Refer:
ruby/ruby#4070https://bugs.ruby-lang.org/issues/16806
Co-authored-by: Ryuta Kamizono <kamipo@gmail.com>
If the media attribute is omitted, the default for web browsers is "all", meaning that by default links apply to all media.
Before:
```ruby
> stylesheet_link_tag "style"
=> <link href="/assets/style.css" media="screen" rel="stylesheet" />
```
After:
```ruby
> stylesheet_link_tag "style"
=> <link href="/assets/style.css" rel="stylesheet" />
```
The current behavior is not going to change for existing applications.
For newly built applications, the media attribute is not going to be added by default. Which can be configured using the following:
```
Rails.application.config.action_view.stylesheet_media_default = false
```
Prevent raising an error when `options` are given as
kwargs, this is done by overriding `options` with kwargs
if `options` are `nil`; this implies that if both `options` and
kwargs are given, `options` takes precedence.
Fixes#41198