Upgrade to support rails 4

1) Use rubocop to fix common ruby coding style errors.
2) Upgrade the gemspec and other files so that the gem now works with a rails 4.x app