Is there a way to run a specific command when the rails console starts? I'd like it to print out whether or not I'm connected to the remote or local database in BIG LETTERS! I don't mind writing a custom method to determine that– I'm just asking how to write to the console. I've seen errors and alerts there before.
For example: rails c
prints out Loading development environment (Rails 3.2.11)
**USING REMOTE DATABASE** 1.9.3p125 :001 >
You can write ruby code in irb
config file. Edit the .irbrc
file and add your ruby code used to determine whether you connected to local or remote
if defined? Rails
//ruby code to find you connected to local or remote
puts "USING REMOTE DATABASE...."
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With