'Unable to Save and Edit credentials.yml.enc in Rubymine or Vim for Rails 6

I am trying to add an API key and token to my credentials.yml.enc file in Rubymine. I can't seem to find a --wait flag or save the generated file from

EDITOR=rubymine rails credentials:edit

or

EDITOR="rubymine --wait" rails credentials:edit

What happens is I add my keys to the file for example:

api_client:
  api_key: 123

but just by opening the file I see a

File encrypted and saved.

message before I can enter anything, so when I spin up my rails console to test my keys like:

 Rails.application.credentials.api_client[:api_key]

I just get back a 'nil' value error.

When I try to edit in vim I get similar results. I can't seem to find any answers online, I am running ruby '2.6.3' with Rails 6.0.2.2 on MacOS Catalina 10.15.4. Thank you all for your time.


Solution: at this time I have found that using a different editor (ATOM) solves the short term problem. I will continue to try and understand if rubymine has this capability as well.



Solution 1:[1]

Try this.. EDITOR="vim" bin/rails credentials:edit Works like charm with MacOS Catalina

Solution 2:[2]

How about

EDITOR = "/Applications/RubyMine.app/Contents/MacOS/rubymine --wait" rails credentials:edit

in macOS Big Sur that is.

Solution 3:[3]

I also got "File encrypted and saved." trying to run EDITOR="vim" bin/rails credentials:edit in a Rails 6.1 project.

It was simply a matter of the editor not being installed – I tried just the vim command to confirm this. After installing Vim (apt-get install vim on this Ubuntu system), it worked as expected.

Solution 4:[4]

I was having a similar issue when trying to use Atom. I realised that I needed to install the Atom shell commands:

Click Atom ? Install Shell Commands

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sathish
Solution 2 Filippos
Solution 3 Henrik N
Solution 4 Jeremy Lynch