aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/commands/encrypted
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/commands/encrypted')
-rw-r--r--railties/lib/rails/commands/encrypted/encrypted_command.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/railties/lib/rails/commands/encrypted/encrypted_command.rb b/railties/lib/rails/commands/encrypted/encrypted_command.rb
index 912c453f09..8d5947652a 100644
--- a/railties/lib/rails/commands/encrypted/encrypted_command.rb
+++ b/railties/lib/rails/commands/encrypted/encrypted_command.rb
@@ -21,9 +21,10 @@ module Rails
def edit(file_path)
require_application_and_environment!
+ encrypted = Rails.application.encrypted(file_path, key_path: options[:key])
ensure_editor_available(command: "bin/rails encrypted:edit") || (return)
- ensure_encryption_key_has_been_added(options[:key])
+ ensure_encryption_key_has_been_added(options[:key]) if encrypted.key.nil?
ensure_encrypted_file_has_been_added(file_path, options[:key])
catch_editing_exceptions do
@@ -75,9 +76,9 @@ module Rails
def missing_encrypted_message(key:, key_path:, file_path:)
if key.nil?
- "Missing '#{key_path}' to decrypt data. See bin/rails encrypted:help"
+ "Missing '#{key_path}' to decrypt data. See `rails encrypted:help`"
else
- "File '#{file_path}' does not exist. Use bin/rails encrypted:edit #{file_path} to change that."
+ "File '#{file_path}' does not exist. Use `rails encrypted:edit #{file_path}` to change that."
end
end
end