Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 5.2 Can't open rails credentials with Sublime Text

I am using Windows Subsystem for Linux with Rails 5.2 and Sublime Text 3. When i do

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

It says "New credentials encrypted and saved." but does not open the file to be edited with Sublime Text 3. Also when trying Visual Studio Code with

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

Visual Studio Code opens but it is empty.

I can only edit the file with VIM and the command EDITOR="vim" rails credentials:edit

The thing is i do not want to edit the file with vim. What is the problem so it does not open the file to be edited with Sublime or VS Code?

I am using Rails 5.2

Thanks a lot in advance

enter image description here

like image 248
sem10 Avatar asked Dec 01 '25 05:12

sem10


2 Answers

On macOS, you would run this command to edit the credentials in Sublime. When you are done, save and close the file in Sublime:

EDITOR="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -w" bin/rails credentials:edit
like image 70
Sébastien Saunier Avatar answered Dec 03 '25 17:12

Sébastien Saunier


I am on windows 7x64 and stumbled upon this issue this morning.Solved it by adding atom to my system variable Path(so cmd & powershell & bash all know about it) and by adding powershell to my environment.I use separate environment for ruby & rails.

So now when I type set EDITOR=atom --wait && rails credentials:edit in cmd or

1st $env:EDITOR="atom --wait", 2nd rails credentials:editin powershell or

EDITOR="atom --wait" rails credentials:edit in bash,

I get the desired result wich is to open credentials and edit them :).. Hope this helps

PS. I didn't need to use --wait flag when setting the editor to subl or notepad! EDITOR is just a temporary variable for the current session, meaning for the cmd,powershell or bash window that is opened at the moment!

like image 35
Goku San Avatar answered Dec 03 '25 17:12

Goku San



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!