Fix gems for Rails 4 support

Fix gems and tests for Rails 4 support. Also tested on production Rails 4 app - all should working.