Skip to content

Commit

Permalink
Merge pull request #46800 from the-spectator/prefer_local_env
Browse files Browse the repository at this point in the history
Prefer using new Rails.env.local?
  • Loading branch information
yahonda committed Dec 23, 2022
2 parents 6d581c4 + c312bb7 commit 15576dd
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/railtie.rb
Expand Up @@ -42,7 +42,7 @@ class Railtie < Rails::Railtie # :nodoc:
action_on_unpermitted_parameters = options.action_on_unpermitted_parameters

if action_on_unpermitted_parameters.nil?
action_on_unpermitted_parameters = (Rails.env.test? || Rails.env.development?) ? :log : false
action_on_unpermitted_parameters = Rails.env.local? ? :log : false
end

ActionController::Parameters.action_on_unpermitted_parameters = action_on_unpermitted_parameters
Expand Down
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/migration.rb
Expand Up @@ -154,7 +154,7 @@ def initialize(message = nil, pending_migrations: nil)
private
def detailed_migration_message(pending_migrations)
message = "Migrations are pending. To resolve this issue, run:\n\n bin/rails db:migrate"
message += " RAILS_ENV=#{::Rails.env}" if defined?(Rails.env) && !(Rails.env.development? || Rails.env.test?)
message += " RAILS_ENV=#{::Rails.env}" if defined?(Rails.env) && !Rails.env.local?
message += "\n\n"

message += "You have #{pending_migrations.size} pending #{pending_migrations.size > 1 ? 'migrations:' : 'migration:'}\n\n"
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/rails/application.rb
Expand Up @@ -471,7 +471,7 @@ def secrets
# then +credentials.secret_key_base+, and finally +secrets.secret_key_base+. For most applications,
# the correct place to store it is in the encrypted credentials file.
def secret_key_base
if Rails.env.development? || Rails.env.test? || ENV["SECRET_KEY_BASE_DUMMY"]
if Rails.env.local? || ENV["SECRET_KEY_BASE_DUMMY"]
secrets.secret_key_base ||= generate_development_secret
else
validate_secret_key_base(
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/rails/application/configuration.rb
Expand Up @@ -280,7 +280,7 @@ def load_defaults(target_version)
self.add_autoload_paths_to_load_path = false
self.precompile_filter_parameters = true

if Rails.env.development? || Rails.env.test?
if Rails.env.local?
self.log_file_size = 100 * 1024 * 1024
end

Expand Down
Expand Up @@ -104,7 +104,7 @@
# `config.load_defaults 7.1` does not set this value for environments other than
# development and test.
#
# if Rails.env.development? || Rails.env.test?
# if Rails.env.local?
# Rails.application.config.log_file_size = 100 * 1024 * 1024
# end

Expand Down

0 comments on commit 15576dd

Please sign in to comment.