actionview 8.0.0.beta1 → 8.0.0.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dec233fd596879151b606bffdbf29f2f8c46fe41675eeb91744d352265254b9d
4
- data.tar.gz: 3623f09bcc8011ac7e69c90d6839f3b8580f0c7c374fd3c2b1261ea4de7bd9d3
3
+ metadata.gz: ce23d8a9002fa8d5652aa3ad756287330509fc1c7c32944a99e5859a70d50d5a
4
+ data.tar.gz: 475923449e3916cd5feb3db9eaf19d44dac25f6b9c01196a63c6995060550d2e
5
5
  SHA512:
6
- metadata.gz: daaae5e335bf7ba563dcf6db84459ee1cdf02053b2f6ae1a9b6422174d338947c47b33cb595db8e641534064d47f1129f07ee4eb72945b933851ed0562a5fc81
7
- data.tar.gz: 67fccc917c86e90ad9201ed67d98e45709c7433a84a80adcf126ecd9b1044ccd72aafa23587e4bada689f9ff2e41f3a21bc51ea8b7e9a11f1af7c6b57a5fee16
6
+ metadata.gz: 2cc4355e81f77ee5f7e06fdddc53e4e7aebdce0b4c8c0d4bc83e9ab39a0042fc70d54acf2a55f6b0f12a79fdda710d4fd5a26fb156edea0b8a5a01a5bc5bbe51
7
+ data.tar.gz: dcdbfa1dc4538656447d4594dee2c6d8c75a67930f9672f80ae3e6d068088f3331fb1f00568da812f35834b058fc9e56d990cfc5e2684149ad43b0fd50ef06f8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## Rails 8.0.0.rc2 (October 30, 2024) ##
2
+
3
+ * No changes.
4
+
5
+
6
+ ## Rails 8.0.0.rc1 (October 19, 2024) ##
7
+
8
+ * Remove deprecated support to passing a content to void tag elements on the `tag` builder.
9
+
10
+ *Rafael Mendonça França*
11
+
12
+ * Remove deprecated support to passing `nil` to the `model:` argument of `form_with`.
13
+
14
+ *Rafael Mendonça França*
15
+
16
+
1
17
  ## Rails 8.0.0.beta1 (September 26, 2024) ##
2
18
 
3
19
  * Enable DependencyTracker to evaluate renders with trailing interpolation.
@@ -127,7 +127,8 @@ module ActionView
127
127
  wildcard_dependency << scanner.pre_match
128
128
 
129
129
  while unmatched_brackets > 0 && !scanner.eos?
130
- scanner.scan_until(/[{}]/)
130
+ found = scanner.scan_until(/[{}]/)
131
+ return unless found
131
132
 
132
133
  case scanner.matched
133
134
  when "{"
@@ -10,7 +10,7 @@ module ActionView
10
10
  MAJOR = 8
11
11
  MINOR = 0
12
12
  TINY = 0
13
- PRE = "beta1"
13
+ PRE = "rc2"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "set"
4
-
5
3
  module ActionView
6
4
  module Helpers # :nodoc:
7
5
  # = Action View Atom Feed \Helpers
@@ -1228,7 +1228,7 @@ module ActionView
1228
1228
  class FormBuilder
1229
1229
  # Wraps ActionView::Helpers::DateHelper#date_select for form builders:
1230
1230
  #
1231
- # <%= form_for @person do |f| %>
1231
+ # <%= form_with model: @person do |f| %>
1232
1232
  # <%= f.date_select :birth_date %>
1233
1233
  # <%= f.submit %>
1234
1234
  # <% end %>
@@ -1240,7 +1240,7 @@ module ActionView
1240
1240
 
1241
1241
  # Wraps ActionView::Helpers::DateHelper#time_select for form builders:
1242
1242
  #
1243
- # <%= form_for @race do |f| %>
1243
+ # <%= form_with model: @race do |f| %>
1244
1244
  # <%= f.time_select :average_lap %>
1245
1245
  # <%= f.submit %>
1246
1246
  # <% end %>
@@ -1252,7 +1252,7 @@ module ActionView
1252
1252
 
1253
1253
  # Wraps ActionView::Helpers::DateHelper#datetime_select for form builders:
1254
1254
  #
1255
- # <%= form_for @person do |f| %>
1255
+ # <%= form_with model: @person do |f| %>
1256
1256
  # <%= f.datetime_select :last_request_at %>
1257
1257
  # <%= f.submit %>
1258
1258
  # <% end %>
@@ -30,20 +30,21 @@ module ActionView
30
30
  # when the form is initially displayed, input fields corresponding to attributes
31
31
  # of the resource should show the current values of those attributes.
32
32
  #
33
- # In \Rails, this is usually achieved by creating the form using +form_for+ and
34
- # a number of related helper methods. +form_for+ generates an appropriate <tt>form</tt>
35
- # tag and yields a form builder object that knows the model the form is about.
36
- # Input fields are created by calling methods defined on the form builder, which
37
- # means they are able to generate the appropriate names and default values
33
+ # In \Rails, this is usually achieved by creating the form using either
34
+ # +form_with+ or +form_for+ and a number of related helper methods. These
35
+ # methods generate an appropriate <tt>form</tt> tag and yield a form
36
+ # builder object that knows the model the form is about. Input fields are
37
+ # created by calling methods defined on the form builder, which means they
38
+ # are able to generate the appropriate names and default values
38
39
  # corresponding to the model attributes, as well as convenient IDs, etc.
39
- # Conventions in the generated field names allow controllers to receive form data
40
- # nicely structured in +params+ with no effort on your side.
40
+ # Conventions in the generated field names allow controllers to receive form
41
+ # data nicely structured in +params+ with no effort on your side.
41
42
  #
42
43
  # For example, to create a new person you typically set up a new instance of
43
44
  # +Person+ in the <tt>PeopleController#new</tt> action, <tt>@person</tt>, and
44
- # in the view template pass that object to +form_for+:
45
+ # in the view template pass that object to +form_with+ or +form_for+:
45
46
  #
46
- # <%= form_for @person do |f| %>
47
+ # <%= form_with model: @person do |f| %>
47
48
  # <%= f.label :first_name %>:
48
49
  # <%= f.text_field :first_name %><br />
49
50
  #
@@ -753,7 +754,7 @@ module ActionView
753
754
  # form_with(**options.merge(builder: LabellingFormBuilder), &block)
754
755
  # end
755
756
  def form_with(model: false, scope: nil, url: nil, format: nil, **options, &block)
756
- ActionView.deprecator.warn("Passing nil to the :model argument is deprecated and will raise in Rails 8.0") if model.nil?
757
+ raise ArgumentError, "Passed nil to the :model argument, expect an object or false" if model.nil?
757
758
 
758
759
  options = { allow_method_names_outside_object: true, skip_default_ids: !form_with_generates_ids }.merge!(options)
759
760
 
@@ -783,9 +784,9 @@ module ActionView
783
784
  end
784
785
  end
785
786
 
786
- # Creates a scope around a specific model object like form_with, but
787
- # doesn't create the form tags themselves. This makes fields_for suitable
788
- # for specifying additional model objects in the same form.
787
+ # Creates a scope around a specific model object like +form_with+, but
788
+ # doesn't create the form tags themselves. This makes +fields_for+
789
+ # suitable for specifying additional model objects in the same form.
789
790
  #
790
791
  # Although the usage and purpose of +fields_for+ is similar to +form_with+'s,
791
792
  # its method signature is slightly different. Like +form_with+, it yields
@@ -2032,9 +2033,9 @@ module ActionView
2032
2033
  end
2033
2034
  alias_method :text_area, :textarea
2034
2035
 
2035
- # Creates a scope around a specific model object like form_with, but
2036
- # doesn't create the form tags themselves. This makes fields_for suitable
2037
- # for specifying additional model objects in the same form.
2036
+ # Creates a scope around a specific model object like +form_with+, but
2037
+ # doesn't create the form tags themselves. This makes +fields_for+
2038
+ # suitable for specifying additional model objects in the same form.
2038
2039
  #
2039
2040
  # Although the usage and purpose of +fields_for+ is similar to +form_with+'s,
2040
2041
  # its method signature is slightly different. Like +form_with+, it yields
@@ -840,7 +840,7 @@ module ActionView
840
840
  class FormBuilder
841
841
  # Wraps ActionView::Helpers::FormOptionsHelper#select for form builders:
842
842
  #
843
- # <%= form_for @post do |f| %>
843
+ # <%= form_with model: @post do |f| %>
844
844
  # <%= f.select :person_id, Person.all.collect { |p| [ p.name, p.id ] }, include_blank: true %>
845
845
  # <%= f.submit %>
846
846
  # <% end %>
@@ -852,7 +852,7 @@ module ActionView
852
852
 
853
853
  # Wraps ActionView::Helpers::FormOptionsHelper#collection_select for form builders:
854
854
  #
855
- # <%= form_for @post do |f| %>
855
+ # <%= form_with model: @post do |f| %>
856
856
  # <%= f.collection_select :person_id, Author.all, :id, :name_with_initial, prompt: true %>
857
857
  # <%= f.submit %>
858
858
  # <% end %>
@@ -864,7 +864,7 @@ module ActionView
864
864
 
865
865
  # Wraps ActionView::Helpers::FormOptionsHelper#grouped_collection_select for form builders:
866
866
  #
867
- # <%= form_for @city do |f| %>
867
+ # <%= form_with model: @city do |f| %>
868
868
  # <%= f.grouped_collection_select :country_id, @continents, :countries, :name, :id, :name %>
869
869
  # <%= f.submit %>
870
870
  # <% end %>
@@ -876,7 +876,7 @@ module ActionView
876
876
 
877
877
  # Wraps ActionView::Helpers::FormOptionsHelper#time_zone_select for form builders:
878
878
  #
879
- # <%= form_for @user do |f| %>
879
+ # <%= form_with model: @user do |f| %>
880
880
  # <%= f.time_zone_select :time_zone, nil, include_blank: true %>
881
881
  # <%= f.submit %>
882
882
  # <% end %>
@@ -888,7 +888,7 @@ module ActionView
888
888
 
889
889
  # Wraps ActionView::Helpers::FormOptionsHelper#weekday_select for form builders:
890
890
  #
891
- # <%= form_for @user do |f| %>
891
+ # <%= form_with model: @user do |f| %>
892
892
  # <%= f.weekday_select :weekday, include_blank: true %>
893
893
  # <%= f.submit %>
894
894
  # <% end %>
@@ -900,7 +900,7 @@ module ActionView
900
900
 
901
901
  # Wraps ActionView::Helpers::FormOptionsHelper#collection_checkboxes for form builders:
902
902
  #
903
- # <%= form_for @post do |f| %>
903
+ # <%= form_with model: @post do |f| %>
904
904
  # <%= f.collection_checkboxes :author_ids, Author.all, :id, :name_with_initial %>
905
905
  # <%= f.submit %>
906
906
  # <% end %>
@@ -913,7 +913,7 @@ module ActionView
913
913
 
914
914
  # Wraps ActionView::Helpers::FormOptionsHelper#collection_radio_buttons for form builders:
915
915
  #
916
- # <%= form_for @post do |f| %>
916
+ # <%= form_with model: @post do |f| %>
917
917
  # <%= f.collection_radio_buttons :author_id, Author.all, :id, :name_with_initial %>
918
918
  # <%= f.submit %>
919
919
  # <% end %>
@@ -4,7 +4,6 @@ require "active_support/code_generator"
4
4
  require "active_support/core_ext/enumerable"
5
5
  require "active_support/core_ext/string/output_safety"
6
6
  require "active_support/core_ext/string/inflections"
7
- require "set"
8
7
  require "action_view/helpers/capture_helper"
9
8
  require "action_view/helpers/output_safety_helper"
10
9
 
@@ -48,16 +47,6 @@ module ActionView
48
47
  include CaptureHelper
49
48
  include OutputSafetyHelper
50
49
 
51
- def deprecated_void_content(name)
52
- ActionView.deprecator.warn <<~TEXT
53
- Putting content inside a void element (#{name}) is invalid
54
- according to the HTML5 spec, and so it is being deprecated
55
- without replacement. In Rails 8.0, passing content as a
56
- positional argument will raise, and using a block will have
57
- no effect.
58
- TEXT
59
- end
60
-
61
50
  def self.define_element(name, code_generator:, method_name: name)
62
51
  return if method_defined?(name)
63
52
 
@@ -72,13 +61,8 @@ module ActionView
72
61
  def self.define_void_element(name, code_generator:, method_name: name)
73
62
  code_generator.class_eval do |batch|
74
63
  batch << "\n" <<
75
- "def #{method_name}(content = nil, escape: true, **options, &block)" <<
76
- " if content || block" <<
77
- " deprecated_void_content(#{name.inspect})" <<
78
- " tag_string(#{name.inspect}, content, options, escape: escape, &block)" <<
79
- " else" <<
80
- " self_closing_tag_string(#{name.inspect}, options, escape, '>')" <<
81
- " end" <<
64
+ "def #{method_name}(escape: true, **options, &block)" <<
65
+ " self_closing_tag_string(#{name.inspect}, options, escape, '>')" <<
82
66
  "end"
83
67
  end
84
68
  end
@@ -166,7 +166,7 @@ module ActionView
166
166
  # highlight('You searched for: rails', 'rails', highlighter: '<a href="search?q=\1">\1</a>')
167
167
  # # => "You searched for: <a href=\"search?q=rails\">rails</a>"
168
168
  #
169
- # highlight('You searched for: rails', 'rails') { |match| link_to(search_path(q: match, match)) }
169
+ # highlight('You searched for: rails', 'rails') { |match| link_to(search_path(q: match)) }
170
170
  # # => "You searched for: <a href=\"search?q=rails\">rails</a>"
171
171
  #
172
172
  # highlight('<a href="javascript:alert(\'no!\')">ruby</a> on rails', 'rails', sanitize: false)
@@ -11,7 +11,7 @@ module ActionView
11
11
  #
12
12
  # Consider for example the following code that form of post:
13
13
  #
14
- # <%= form_for(post) do |f| %>
14
+ # <%= form_with(model: post) do |f| %>
15
15
  # <%= f.text_field :body %>
16
16
  # <% end %>
17
17
  #
@@ -229,11 +229,21 @@ module ActionView
229
229
  end
230
230
 
231
231
  def spot(location) # :nodoc:
232
- ast = RubyVM::AbstractSyntaxTree.parse(compiled_source, keep_script_lines: true)
233
232
  node_id = RubyVM::AbstractSyntaxTree.node_id_for_backtrace_location(location)
234
- node = find_node_by_id(ast, node_id)
233
+ found =
234
+ if RubyVM::InstructionSequence.compile("").to_a[4][:parser] == :prism
235
+ require "prism"
235
236
 
236
- ErrorHighlight.spot(node)
237
+ if Prism::VERSION >= "1.0.0"
238
+ result = Prism.parse(compiled_source).value
239
+ result.breadth_first_search { |node| node.node_id == node_id }
240
+ end
241
+ else
242
+ node = RubyVM::AbstractSyntaxTree.parse(compiled_source, keep_script_lines: true)
243
+ find_node_by_id(node, node_id)
244
+ end
245
+
246
+ ErrorHighlight.spot(found) if found
237
247
  end
238
248
 
239
249
  # Translate an error location returned by ErrorHighlight to the correct
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionview
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.0.beta1
4
+ version: 8.0.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-26 00:00:00.000000000 Z
11
+ date: 2024-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 8.0.0.beta1
19
+ version: 8.0.0.rc2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 8.0.0.beta1
26
+ version: 8.0.0.rc2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: builder
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -86,28 +86,28 @@ dependencies:
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 8.0.0.beta1
89
+ version: 8.0.0.rc2
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 8.0.0.beta1
96
+ version: 8.0.0.rc2
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: activemodel
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 8.0.0.beta1
103
+ version: 8.0.0.rc2
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 8.0.0.beta1
110
+ version: 8.0.0.rc2
111
111
  description: Simple, battle-tested conventions and helpers for building web pages.
112
112
  email: david@loudthinking.com
113
113
  executables: []
@@ -247,10 +247,10 @@ licenses:
247
247
  - MIT
248
248
  metadata:
249
249
  bug_tracker_uri: https://github.com/rails/rails/issues
250
- changelog_uri: https://github.com/rails/rails/blob/v8.0.0.beta1/actionview/CHANGELOG.md
251
- documentation_uri: https://api.rubyonrails.org/v8.0.0.beta1/
250
+ changelog_uri: https://github.com/rails/rails/blob/v8.0.0.rc2/actionview/CHANGELOG.md
251
+ documentation_uri: https://api.rubyonrails.org/v8.0.0.rc2/
252
252
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
253
- source_code_uri: https://github.com/rails/rails/tree/v8.0.0.beta1/actionview
253
+ source_code_uri: https://github.com/rails/rails/tree/v8.0.0.rc2/actionview
254
254
  rubygems_mfa_required: 'true'
255
255
  post_install_message:
256
256
  rdoc_options: []