Add Rails 4 support

This pull-request includes necessary changes to support Rails 4. The backwards compatibility is broken, so it will not work on Rails 2.3 anymore and Rails 3.

I also fixed generators and updated some old dependences.

All RSpec tests are passing.