Made progress with Rails 4 upgrade

Made progress with Rails 4 upgrade

- Merged with latest master
- Updated Rails version to 4.0.0 final
- Corrected several deprecation warnings