162 liens privés
Allergic to vi*
/ emacs
editor ? You like nano better for your usage : then forget
nano, welcome
micro.
micro` is just what you're looking for :
- Shortcuts you are familar with ( select with shift + arrows, CTRL + c / CTRL + x / CTRL +v / CTRL + a and much more).
- Integrated help (CTRL +g)
- Integrated "micro" command line (CTRL + e) like you have in vim
- ctrl + q to quit
- Syntax highlighting, completion
- Screen split
...
Oh, and ... BONUS : usage of the mouse !
sudo apt install micro
right away (tested in ubuntu desktop 20.04 / 21.04 / 22.04 and server 22.04 and mint).
I restart local database (postgres in a docker container) and then my server bundle exec bin/rails s
After that I go to the console with bundle exec bin/rails c
(or bin/rails c
or bundle exec rails c
),
being in the project root folder.
Sometimes (not sure exactly why yet), environment get messed up.
When trying a request such as : User.count
I get a weird error.
could not connect to server: No such file or directory (ActiveRecord::ConnectionNotEstablished)
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
While the server is running locally and could connect to the database.
It happens the console explicitly starts with the following announcement :
Running via Spring preloader in process 1720240
Hey ! That's a good hint.
Of course, I did disregard it completly for a couple hours -- more than once.
The solution is so often related though. You reload the database and the server,
under spring preloader's feet.
spring prelaoder is so lost ! Let's restart it too.
Solution :
spring stop
bin/rails console
and voilà ! It works again.
Edit 2022-01-23 :
Beware, in the new console, if you do User
and get this answer :
User (call 'User.connection' to establish a connection)
Solution is very simple : User.last
and there you go. Connexion established, problem solved
I restart local database (postgres in a docker container) and then my server bundle exec bin/rails s
After that I go to the console with bundle exec bin/rails c
(or bin/rails c
or bundle exec rails c
),
being in the project root folder.
Sometimes (not sure exactly why yet), environment get messed up.
When trying a request such as : User.count
I get a weird error.
could not connect to server: No such file or directory (ActiveRecord::ConnectionNotEstablished)
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
While the server is running locally and could connect to the database.
It happens the console explicitly starts with the following announcement :
Running via Spring preloader in process 1720240
Hey ! That's a good hint.
Of course, I did disregard it completly for a couple hours more than once.
The solution is so often related though. You reload the database and the server,
under spring preloader's feet.
spring prelaoder is so lost ! Let's restart it too.
Solution :
spring stop
bin/rails console
and voilà ! It works again.