Refactor rails.rb

Try to get rid of this CodeClimate's C grade !