Shortcut to ssh directly to Rails console

On Heroku, I can run heroku run rails console, and (eventually) what I get is the rails console. That’s what I want! I so rarely want an ssh shell.

On Render, I have succeeded in running the shell directly for a particular server (render ssh [name-of-service]), but it just opens up with the shell, and I have to run rails c and wait, like an animal.

If I could figure out how to add to the login shell’s profile/rc file (I haven’t been successful), I could maybe tell it to run the shell by default, or when an env variable is passed. A normal SSH command forwards all LC_* environment variables, so on other servers I control I do a little dance (if [ -n "$LC_RAILS_SESSION" ]; then… and conditionally run the shell. It works great and is very convenient!

Any ideas about how to run a command after login? Even if it ran every time that would be more convenient.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.