railties 7.0.0.rc1 → 7.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +44 -0
- data/MIT-LICENSE +1 -1
- data/lib/rails/application/configuration.rb +9 -3
- data/lib/rails/application/finisher.rb +0 -1
- data/lib/rails/application.rb +4 -1
- data/lib/rails/autoloaders/inflector.rb +1 -1
- data/lib/rails/autoloaders.rb +40 -36
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +10 -7
- data/lib/rails/gem_version.rb +2 -2
- data/lib/rails/generators/actions.rb +30 -13
- data/lib/rails/generators/app_base.rb +77 -54
- data/lib/rails/generators/erb/scaffold/templates/edit.html.erb.tt +2 -2
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt +7 -2
- data/lib/rails/generators/erb/scaffold/templates/new.html.erb.tt +1 -1
- data/lib/rails/generators/erb/scaffold/templates/partial.html.erb.tt +0 -3
- data/lib/rails/generators/erb/scaffold/templates/show.html.erb.tt +3 -3
- data/lib/rails/generators/named_base.rb +10 -10
- data/lib/rails/generators/rails/app/app_generator.rb +1 -0
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +10 -14
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +0 -31
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_0.rb.tt +0 -4
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +39 -16
- data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +8 -30
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +0 -5
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +5 -5
- data/lib/rails/generators/testing/behaviour.rb +2 -2
- data/lib/rails/templates/rails/welcome/index.html.erb +60 -48
- data/lib/rails.rb +1 -2
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '02971c2aea82d6438c050e658cf682158f9942bd3b2d37a957af8e9869e6e26e'
|
4
|
+
data.tar.gz: f448cdadd24a8c84fded45c69536d451ba1e7921bcde12aafd6dc0ef33c44b0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d199f6437a4650717d50a7a42c76ec847017809ffe1c53e0720c2ae6c9938fbaab00b491c9de61e482b8dca0f10b1c81be3f8d69edfbfd1fdeb9a52322dc89e5
|
7
|
+
data.tar.gz: b076e654baa6d781d0c7668e2f034facc363d14fc4245207e586dcf74fe8fc0c18410b1fdd230d979976b42f53beeef5ac47a05dc9f89b1b69259e246aac49d0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,47 @@
|
|
1
|
+
## Rails 7.0.1 (January 06, 2022) ##
|
2
|
+
|
3
|
+
* Prevent duplicate entries in plugin Gemfile.
|
4
|
+
|
5
|
+
*Jonathan Hefner*
|
6
|
+
|
7
|
+
* Fix asset pipeline errors for plugin dummy apps.
|
8
|
+
|
9
|
+
*Jonathan Hefner*
|
10
|
+
|
11
|
+
* Fix generated route revocation.
|
12
|
+
|
13
|
+
*Jonathan Hefner*
|
14
|
+
|
15
|
+
* Addresses an issue in which Sidekiq jobs could not reload certain
|
16
|
+
namespaces.
|
17
|
+
|
18
|
+
See [fxn/zeitwerk#198](https://github.com/fxn/zeitwerk/issues/198) for
|
19
|
+
details.
|
20
|
+
|
21
|
+
*Xavier Noria*
|
22
|
+
|
23
|
+
* Fix plugin generator to a plugin that pass all the tests.
|
24
|
+
|
25
|
+
*Rafael Mendonça França*
|
26
|
+
|
27
|
+
|
28
|
+
## Rails 7.0.0 (December 15, 2021) ##
|
29
|
+
|
30
|
+
* No changes.
|
31
|
+
|
32
|
+
|
33
|
+
## Rails 7.0.0.rc3 (December 14, 2021) ##
|
34
|
+
|
35
|
+
* Allow localhost with a port by default in development
|
36
|
+
|
37
|
+
[Fixes: #43864]
|
38
|
+
|
39
|
+
## Rails 7.0.0.rc2 (December 14, 2021) ##
|
40
|
+
|
41
|
+
* No changes
|
42
|
+
|
43
|
+
## Rails 7.0.0.rc1 (December 06, 2021) ##
|
44
|
+
|
1
45
|
* Remove deprecated `config` in `dbconsole`.
|
2
46
|
|
3
47
|
*Rafael Mendonça França*
|
data/MIT-LICENSE
CHANGED
@@ -33,8 +33,12 @@ module Rails
|
|
33
33
|
@filter_parameters = []
|
34
34
|
@filter_redirect = []
|
35
35
|
@helpers_paths = []
|
36
|
-
|
37
|
-
|
36
|
+
if Rails.env.development?
|
37
|
+
@hosts = ActionDispatch::HostAuthorization::ALLOWED_HOSTS_IN_DEVELOPMENT +
|
38
|
+
ENV["RAILS_DEVELOPMENT_HOSTS"].to_s.split(",").map(&:strip)
|
39
|
+
else
|
40
|
+
@hosts = []
|
41
|
+
end
|
38
42
|
@host_authorization = {}
|
39
43
|
@public_file_server = ActiveSupport::OrderedOptions.new
|
40
44
|
@public_file_server.enabled = true
|
@@ -84,6 +88,7 @@ module Rails
|
|
84
88
|
if respond_to?(:action_controller)
|
85
89
|
action_controller.per_form_csrf_tokens = true
|
86
90
|
action_controller.forgery_protection_origin_check = true
|
91
|
+
action_controller.urlsafe_csrf_tokens = false
|
87
92
|
end
|
88
93
|
|
89
94
|
ActiveSupport.to_time_preserves_timezone = true
|
@@ -169,7 +174,7 @@ module Rails
|
|
169
174
|
end
|
170
175
|
|
171
176
|
if respond_to?(:action_controller)
|
172
|
-
action_controller.urlsafe_csrf_tokens
|
177
|
+
action_controller.delete(:urlsafe_csrf_tokens)
|
173
178
|
end
|
174
179
|
|
175
180
|
if respond_to?(:action_view)
|
@@ -236,6 +241,7 @@ module Rails
|
|
236
241
|
" -frames:v 1 -f image2"
|
237
242
|
|
238
243
|
active_storage.variant_processor = :vips
|
244
|
+
active_storage.multiple_file_field_include_hidden = true
|
239
245
|
end
|
240
246
|
|
241
247
|
if respond_to?(:active_record)
|
data/lib/rails/application.rb
CHANGED
@@ -10,6 +10,7 @@ require "active_support/hash_with_indifferent_access"
|
|
10
10
|
require "active_support/configuration_file"
|
11
11
|
require "rails/engine"
|
12
12
|
require "rails/secrets"
|
13
|
+
require "rails/autoloaders"
|
13
14
|
|
14
15
|
module Rails
|
15
16
|
# An Engine with the responsibility of coordinating the whole boot process.
|
@@ -95,7 +96,7 @@ module Rails
|
|
95
96
|
|
96
97
|
attr_accessor :assets, :sandbox
|
97
98
|
alias_method :sandbox?, :sandbox
|
98
|
-
attr_reader :reloaders, :reloader, :executor
|
99
|
+
attr_reader :reloaders, :reloader, :executor, :autoloaders
|
99
100
|
|
100
101
|
delegate :default_url_options, :default_url_options=, to: :routes
|
101
102
|
|
@@ -117,6 +118,8 @@ module Rails
|
|
117
118
|
@reloader = Class.new(ActiveSupport::Reloader)
|
118
119
|
@reloader.executor = @executor
|
119
120
|
|
121
|
+
@autoloaders = Rails::Autoloaders.new
|
122
|
+
|
120
123
|
# are these actually used?
|
121
124
|
@initial_variable_values = initial_variable_values
|
122
125
|
@block = block
|
data/lib/rails/autoloaders.rb
CHANGED
@@ -1,44 +1,48 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "zeitwerk"
|
4
|
-
|
5
3
|
module Rails
|
6
|
-
|
4
|
+
class Autoloaders # :nodoc:
|
7
5
|
require_relative "autoloaders/inflector"
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
7
|
+
include Enumerable
|
8
|
+
|
9
|
+
attr_reader :main, :once
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
# This `require` delays loading the library on purpose.
|
13
|
+
#
|
14
|
+
# In Rails 7.0.0, railties/lib/rails.rb loaded Zeitwerk as a side-effect,
|
15
|
+
# but a couple of edge cases related to Bundler and Bootsnap showed up.
|
16
|
+
# They had to do with order of decoration of `Kernel#require`, something
|
17
|
+
# the three of them do.
|
18
|
+
#
|
19
|
+
# Delaying this `require` up to this point is a convenient trade-off.
|
20
|
+
require "zeitwerk"
|
21
|
+
|
22
|
+
@main = Zeitwerk::Loader.new
|
23
|
+
@main.tag = "rails.main"
|
24
|
+
@main.inflector = Inflector
|
25
|
+
|
26
|
+
@once = Zeitwerk::Loader.new
|
27
|
+
@once.tag = "rails.once"
|
28
|
+
@once.inflector = Inflector
|
29
|
+
end
|
30
|
+
|
31
|
+
def each
|
32
|
+
yield main
|
33
|
+
yield once
|
34
|
+
end
|
35
|
+
|
36
|
+
def logger=(logger)
|
37
|
+
each { |loader| loader.logger = logger }
|
38
|
+
end
|
39
|
+
|
40
|
+
def log!
|
41
|
+
each(&:log!)
|
42
|
+
end
|
43
|
+
|
44
|
+
def zeitwerk_enabled?
|
45
|
+
true
|
42
46
|
end
|
43
47
|
end
|
44
48
|
end
|
@@ -97,15 +97,18 @@ module Rails
|
|
97
97
|
def db_config
|
98
98
|
return @db_config if defined?(@db_config)
|
99
99
|
|
100
|
-
#
|
101
|
-
# first
|
102
|
-
|
103
|
-
|
104
|
-
|
100
|
+
# If the user provided a database, use that. Otherwise find
|
101
|
+
# the first config in the database.yml
|
102
|
+
if database
|
103
|
+
@db_config = configurations.configs_for(env_name: environment, name: database, include_hidden: true)
|
104
|
+
else
|
105
|
+
@db_config = configurations.find_db_config(environment)
|
106
|
+
end
|
105
107
|
|
106
108
|
unless @db_config
|
109
|
+
missing_db = database ? "'#{database}' database is not" : "No databases are"
|
107
110
|
raise ActiveRecord::AdapterNotSpecified,
|
108
|
-
"
|
111
|
+
"#{missing_db} configured for '#{environment}'. Available configuration: #{configurations.inspect}"
|
109
112
|
end
|
110
113
|
|
111
114
|
@db_config
|
@@ -116,7 +119,7 @@ module Rails
|
|
116
119
|
end
|
117
120
|
|
118
121
|
def database
|
119
|
-
@options
|
122
|
+
@options[:database]
|
120
123
|
end
|
121
124
|
|
122
125
|
private
|
data/lib/rails/gem_version.rb
CHANGED
@@ -279,26 +279,32 @@ module Rails
|
|
279
279
|
# route "root 'welcome#index'"
|
280
280
|
# route "root 'admin#index'", namespace: :admin
|
281
281
|
def route(routing_code, namespace: nil)
|
282
|
-
|
283
|
-
|
282
|
+
namespace = Array(namespace)
|
283
|
+
namespace_pattern = route_namespace_pattern(namespace)
|
284
|
+
routing_code = namespace.reverse.reduce(routing_code) do |code, name|
|
285
|
+
"namespace :#{name} do\n#{rebase_indentation(code, 2)}end"
|
284
286
|
end
|
285
287
|
|
286
288
|
log :route, routing_code
|
287
289
|
|
288
|
-
after_pattern = Array(namespace).each_with_index.reverse_each.reduce(nil) do |pattern, (ns, i)|
|
289
|
-
margin = "\\#{i + 1}[ ]{2}"
|
290
|
-
"(?:(?:^[ ]*\n|^#{margin}.*\n)*?^(#{margin})namespace :#{ns} do\n#{pattern})?"
|
291
|
-
end.then do |pattern|
|
292
|
-
/^([ ]*).+\.routes\.draw do[ ]*\n#{pattern}/
|
293
|
-
end
|
294
|
-
|
295
290
|
in_root do
|
296
|
-
if
|
297
|
-
base_indent, *,
|
298
|
-
|
291
|
+
if namespace_match = match_file("config/routes.rb", namespace_pattern)
|
292
|
+
base_indent, *, existing_block_indent = namespace_match.captures.compact.map(&:length)
|
293
|
+
existing_line_pattern = /^[ ]{,#{existing_block_indent}}\S.+\n?/
|
294
|
+
routing_code = rebase_indentation(routing_code, base_indent + 2).gsub(existing_line_pattern, "")
|
295
|
+
namespace_pattern = /#{Regexp.escape namespace_match.to_s}/
|
299
296
|
end
|
300
297
|
|
301
|
-
inject_into_file "config/routes.rb", routing_code, after:
|
298
|
+
inject_into_file "config/routes.rb", routing_code, after: namespace_pattern, verbose: false, force: false
|
299
|
+
|
300
|
+
if behavior == :revoke && namespace.any? && namespace_match
|
301
|
+
empty_block_pattern = /(#{namespace_pattern})((?:\s*end\n){1,#{namespace.size}})/
|
302
|
+
gsub_file "config/routes.rb", empty_block_pattern, verbose: false, force: true do |matched|
|
303
|
+
beginning, ending = empty_block_pattern.match(matched).captures
|
304
|
+
ending.sub!(/\A\s*end\n/, "") while !ending.empty? && beginning.sub!(/^[ ]*namespace .+ do\n\s*\z/, "")
|
305
|
+
beginning + ending
|
306
|
+
end
|
307
|
+
end
|
302
308
|
end
|
303
309
|
end
|
304
310
|
|
@@ -363,6 +369,7 @@ module Rails
|
|
363
369
|
return "#{value}\n" unless value.is_a?(String)
|
364
370
|
"#{value.strip_heredoc.indent(amount).chomp}\n"
|
365
371
|
end
|
372
|
+
alias rebase_indentation optimize_indentation
|
366
373
|
|
367
374
|
# Indent the +Gemfile+ to the depth of @indentation
|
368
375
|
def indentation # :doc:
|
@@ -387,6 +394,16 @@ module Rails
|
|
387
394
|
def match_file(path, pattern)
|
388
395
|
File.read(path).match(pattern) if File.exist?(path)
|
389
396
|
end
|
397
|
+
|
398
|
+
def route_namespace_pattern(namespace)
|
399
|
+
namespace.each_with_index.reverse_each.reduce(nil) do |pattern, (name, i)|
|
400
|
+
cummulative_margin = "\\#{i + 1}[ ]{2}"
|
401
|
+
blank_or_indented_line = "^[ ]*\n|^#{cummulative_margin}.*\n"
|
402
|
+
"(?:(?:#{blank_or_indented_line})*?^(#{cummulative_margin})namespace :#{name} do\n#{pattern})?"
|
403
|
+
end.then do |pattern|
|
404
|
+
/^([ ]*).+\.routes\.draw do[ ]*\n#{pattern}/
|
405
|
+
end
|
406
|
+
end
|
390
407
|
end
|
391
408
|
end
|
392
409
|
end
|
@@ -100,23 +100,26 @@ module Rails
|
|
100
100
|
desc: "Show this help message and quit"
|
101
101
|
end
|
102
102
|
|
103
|
-
def initialize(*)
|
103
|
+
def initialize(positional_argv, option_argv, *)
|
104
|
+
@argv = [*positional_argv, *option_argv]
|
104
105
|
@gem_filter = lambda { |gem| true }
|
105
106
|
super
|
106
107
|
end
|
107
108
|
|
108
109
|
private
|
109
110
|
def gemfile_entries # :doc:
|
110
|
-
[
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
111
|
+
[
|
112
|
+
rails_gemfile_entry,
|
113
|
+
asset_pipeline_gemfile_entry,
|
114
|
+
database_gemfile_entry,
|
115
|
+
web_server_gemfile_entry,
|
116
|
+
javascript_gemfile_entry,
|
117
|
+
hotwire_gemfile_entry,
|
118
|
+
css_gemfile_entry,
|
119
|
+
jbuilder_gemfile_entry,
|
120
|
+
psych_gemfile_entry,
|
121
|
+
cable_gemfile_entry,
|
122
|
+
].flatten.compact.select(&@gem_filter)
|
120
123
|
end
|
121
124
|
|
122
125
|
def builder # :doc:
|
@@ -158,7 +161,8 @@ module Rails
|
|
158
161
|
end
|
159
162
|
|
160
163
|
def database_gemfile_entry # :doc:
|
161
|
-
return
|
164
|
+
return if options[:skip_active_record]
|
165
|
+
|
162
166
|
gem_name, gem_version = gem_for_database
|
163
167
|
GemfileEntry.version gem_name, gem_version,
|
164
168
|
"Use #{options[:database]} as the database for Active Record"
|
@@ -169,15 +173,13 @@ module Rails
|
|
169
173
|
end
|
170
174
|
|
171
175
|
def asset_pipeline_gemfile_entry
|
172
|
-
return
|
176
|
+
return if options[:skip_asset_pipeline]
|
173
177
|
|
174
178
|
if options[:asset_pipeline] == "sprockets"
|
175
|
-
GemfileEntry.
|
179
|
+
GemfileEntry.floats "sprockets-rails",
|
176
180
|
"The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]"
|
177
181
|
elsif options[:asset_pipeline] == "propshaft"
|
178
|
-
GemfileEntry.
|
179
|
-
else
|
180
|
-
[]
|
182
|
+
GemfileEntry.floats "propshaft", "The modern asset pipeline for Rails [https://github.com/rails/propshaft]"
|
181
183
|
end
|
182
184
|
end
|
183
185
|
|
@@ -255,39 +257,40 @@ module Rails
|
|
255
257
|
new(name, version, comment)
|
256
258
|
end
|
257
259
|
|
260
|
+
def self.floats(name, comment = nil)
|
261
|
+
new(name, nil, comment)
|
262
|
+
end
|
263
|
+
|
258
264
|
def self.path(name, path, comment = nil)
|
259
265
|
new(name, nil, comment, path: path)
|
260
266
|
end
|
261
267
|
|
262
|
-
def
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
268
|
+
def to_s
|
269
|
+
[
|
270
|
+
(comment.gsub(/^/, "# ").chomp + "\n" if comment),
|
271
|
+
("# " if commented_out),
|
272
|
+
"gem \"#{name}\"",
|
273
|
+
*Array(version).map { |constraint| ", \"#{constraint}\"" },
|
274
|
+
*options.map { |key, value| ", #{key}: #{value.inspect}" },
|
275
|
+
].compact.join
|
270
276
|
end
|
271
277
|
end
|
272
278
|
|
279
|
+
def rails_prerelease?
|
280
|
+
options.dev? || options.edge? || options.main?
|
281
|
+
end
|
282
|
+
|
273
283
|
def rails_gemfile_entry
|
274
284
|
if options.dev?
|
275
|
-
|
276
|
-
GemfileEntry.path("rails", Rails::Generators::RAILS_DEV_PATH, "Use local checkout of Rails")
|
277
|
-
]
|
285
|
+
GemfileEntry.path("rails", Rails::Generators::RAILS_DEV_PATH, "Use local checkout of Rails")
|
278
286
|
elsif options.edge?
|
279
287
|
edge_branch = Rails.gem_version.prerelease? ? "main" : [*Rails.gem_version.segments.first(2), "stable"].join("-")
|
280
|
-
|
281
|
-
GemfileEntry.github("rails", "rails/rails", edge_branch, "Use specific branch of Rails")
|
282
|
-
]
|
288
|
+
GemfileEntry.github("rails", "rails/rails", edge_branch, "Use specific branch of Rails")
|
283
289
|
elsif options.main?
|
284
|
-
|
285
|
-
GemfileEntry.github("rails", "rails/rails", "main", "Use main development branch of Rails")
|
286
|
-
]
|
290
|
+
GemfileEntry.github("rails", "rails/rails", "main", "Use main development branch of Rails")
|
287
291
|
else
|
288
|
-
|
289
|
-
|
290
|
-
%(Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"))]
|
292
|
+
GemfileEntry.version("rails", rails_version_specifier,
|
293
|
+
%(Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"))
|
291
294
|
end
|
292
295
|
end
|
293
296
|
|
@@ -305,29 +308,28 @@ module Rails
|
|
305
308
|
end
|
306
309
|
|
307
310
|
def jbuilder_gemfile_entry
|
308
|
-
return
|
309
|
-
|
310
|
-
GemfileEntry.new "jbuilder", "~> 2.11", comment, {}, options[:api]
|
311
|
+
return if options[:skip_jbuilder]
|
312
|
+
GemfileEntry.new "jbuilder", nil, "Build JSON APIs with ease [https://github.com/rails/jbuilder]", {}, options[:api]
|
311
313
|
end
|
312
314
|
|
313
315
|
def javascript_gemfile_entry
|
314
|
-
return
|
316
|
+
return if options[:skip_javascript]
|
315
317
|
|
316
318
|
if adjusted_javascript_option == "importmap"
|
317
|
-
GemfileEntry.
|
319
|
+
GemfileEntry.floats "importmap-rails", "Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]"
|
318
320
|
else
|
319
|
-
GemfileEntry.
|
321
|
+
GemfileEntry.floats "jsbundling-rails", "Bundle and transpile JavaScript [https://github.com/rails/jsbundling-rails]"
|
320
322
|
end
|
321
323
|
end
|
322
324
|
|
323
325
|
def hotwire_gemfile_entry
|
324
|
-
return
|
326
|
+
return if options[:skip_javascript] || options[:skip_hotwire]
|
325
327
|
|
326
328
|
turbo_rails_entry =
|
327
|
-
GemfileEntry.
|
329
|
+
GemfileEntry.floats "turbo-rails", "Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]"
|
328
330
|
|
329
331
|
stimulus_rails_entry =
|
330
|
-
GemfileEntry.
|
332
|
+
GemfileEntry.floats "stimulus-rails", "Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]"
|
331
333
|
|
332
334
|
[ turbo_rails_entry, stimulus_rails_entry ]
|
333
335
|
end
|
@@ -347,17 +349,17 @@ module Rails
|
|
347
349
|
end
|
348
350
|
|
349
351
|
def css_gemfile_entry
|
350
|
-
return
|
352
|
+
return unless options[:css]
|
351
353
|
|
352
354
|
if !using_node? && options[:css] == "tailwind"
|
353
|
-
GemfileEntry.
|
355
|
+
GemfileEntry.floats "tailwindcss-rails", "Use Tailwind CSS [https://github.com/rails/tailwindcss-rails]"
|
354
356
|
else
|
355
|
-
GemfileEntry.
|
357
|
+
GemfileEntry.floats "cssbundling-rails", "Bundle and process CSS [https://github.com/rails/cssbundling-rails]"
|
356
358
|
end
|
357
359
|
end
|
358
360
|
|
359
361
|
def psych_gemfile_entry
|
360
|
-
return
|
362
|
+
return unless defined?(Rubinius)
|
361
363
|
|
362
364
|
comment = "Use Psych as the YAML engine, instead of Syck, so serialized " \
|
363
365
|
"data can be read safely from different rubies (see http://git.io/uuLVag)"
|
@@ -365,11 +367,10 @@ module Rails
|
|
365
367
|
end
|
366
368
|
|
367
369
|
def cable_gemfile_entry
|
368
|
-
return
|
370
|
+
return if options[:skip_action_cable]
|
371
|
+
|
369
372
|
comment = "Use Redis adapter to run Action Cable in production"
|
370
|
-
|
371
|
-
gems << GemfileEntry.new("redis", "~> 4.0", comment, {}, true)
|
372
|
-
gems
|
373
|
+
GemfileEntry.new("redis", "~> 4.0", comment, {}, true)
|
373
374
|
end
|
374
375
|
|
375
376
|
def bundle_command(command, env = {})
|
@@ -410,6 +411,28 @@ module Rails
|
|
410
411
|
!options[:skip_bootsnap] && !options[:dev] && !defined?(JRUBY_VERSION)
|
411
412
|
end
|
412
413
|
|
414
|
+
def target_rails_prerelease(self_command = "new")
|
415
|
+
return unless rails_prerelease? && bundle_install?
|
416
|
+
|
417
|
+
if !File.exist?(File.expand_path("Gemfile", destination_root))
|
418
|
+
create_file("Gemfile", <<~GEMFILE)
|
419
|
+
source "https://rubygems.org"
|
420
|
+
git_source(:github) { |repo| "https://github.com/\#{repo}.git" }
|
421
|
+
#{rails_gemfile_entry}
|
422
|
+
GEMFILE
|
423
|
+
|
424
|
+
run_bundle
|
425
|
+
|
426
|
+
@argv[0] = destination_root
|
427
|
+
require "shellwords"
|
428
|
+
bundle_command("exec rails #{self_command} #{Shellwords.join(@argv)}")
|
429
|
+
exit
|
430
|
+
else
|
431
|
+
remove_file("Gemfile")
|
432
|
+
remove_file("Gemfile.lock")
|
433
|
+
end
|
434
|
+
end
|
435
|
+
|
413
436
|
def run_bundle
|
414
437
|
bundle_command("install", "BUNDLE_IGNORE_MESSAGES" => "1") if bundle_install?
|
415
438
|
end
|
@@ -5,6 +5,6 @@
|
|
5
5
|
<br>
|
6
6
|
|
7
7
|
<div>
|
8
|
-
<%%= link_to "Show this <%= human_name.downcase %>",
|
9
|
-
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper %>
|
8
|
+
<%%= link_to "Show this <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %> %> |
|
9
|
+
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %> %>
|
10
10
|
</div>
|
@@ -3,7 +3,12 @@
|
|
3
3
|
<h1><%= human_name.pluralize %></h1>
|
4
4
|
|
5
5
|
<div id="<%= plural_table_name %>">
|
6
|
-
|
6
|
+
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
|
7
|
+
<%%= render <%= singular_table_name %> %>
|
8
|
+
<p>
|
9
|
+
<%%= link_to "Show this <%= human_name.downcase %>", <%= model_resource_name(singular_table_name) %> %>
|
10
|
+
</p>
|
11
|
+
<%% end %>
|
7
12
|
</div>
|
8
13
|
|
9
|
-
<%%= link_to "New <%= human_name.downcase %>",
|
14
|
+
<%%= link_to "New <%= human_name.downcase %>", <%= new_helper(type: :path) %> %>
|
@@ -3,8 +3,8 @@
|
|
3
3
|
<%%= render @<%= singular_table_name %> %>
|
4
4
|
|
5
5
|
<div>
|
6
|
-
<%%= link_to "Edit this <%= human_name.downcase %>",
|
7
|
-
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper %>
|
6
|
+
<%%= link_to "Edit this <%= human_name.downcase %>", <%= edit_helper(type: :path) %> %> |
|
7
|
+
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %> %>
|
8
8
|
|
9
|
-
<%%= button_to "Destroy this <%= human_name.downcase %>", <%=
|
9
|
+
<%%= button_to "Destroy this <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>, method: :delete %>
|
10
10
|
</div>
|