Created
April 9, 2012 17:34
-
-
Save paneq/2344900 to your computer and use it in GitHub Desktop.
My fix for local database definition in rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :db do | |
def local_database?(config, &block) | |
if config['host'].in?(['127.0.0.1', 'localhost', '192.168.30.1']) || config['host'].blank? | |
yield | |
else | |
$stderr.puts "This task only modifies local databases. #{config['database']} is on a remote host." | |
end | |
end | |
end |
Thanks! 👍
Thank you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FYI
also works (tested in rails 4.2).