check if db is available first
Merge pull request #2 from uts/rails4

check if db is available first