Rails4

Merge changes from @davidlbatey