Feature/rails 4 upgrade

@nigelramsay can you please review this?