Skip to content

Commit 5f3c0d6

Browse files
committed
Avoid Action Cable config in dev templates on --skip-action-cable
rails new --skip-aciton-cable now generates config/environments/development.rb without Action Cable configurations. Follows up PRs 22586 and 24169 Signed-off-by: Takuya Noguchi <[email protected]>
1 parent a5f113f commit 5f3c0d6

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

railties/lib/rails/generators/app_base.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,10 @@ def skip_active_storage? # :doc:
345345
options[:skip_active_storage]
346346
end
347347

348+
def skip_action_cable? # :doc:
349+
options[:skip_action_cable]
350+
end
351+
348352
def skip_action_mailer? # :doc:
349353
options[:skip_action_mailer]
350354
end

railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,11 @@ Rails.application.configure do
8080
# Annotate rendered view with file names.
8181
# config.action_view.annotate_rendered_view_with_filenames = true
8282

83+
<%- unless skip_action_cable? -%>
8384
# Uncomment if you wish to allow Action Cable access from any origin.
8485
# config.action_cable.disable_request_forgery_protection = true
8586

87+
<%- end -%>
8688
# Raise error when a before_action's only/except options reference missing actions
8789
config.action_controller.raise_on_missing_callback_actions = true
8890
end

railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Rails.application.configure do
4545
config.active_storage.service = :local
4646

4747
<%- end -%>
48-
<%- unless options[:skip_action_cable] -%>
48+
<%- unless skip_action_cable? -%>
4949
# Mount Action Cable outside main process or domain.
5050
# config.action_cable.mount_path = nil
5151
# config.action_cable.url = "wss://example.com/cable"

0 commit comments

Comments
 (0)