fix functions for Rails 4
functions and tests for Rails 4. According to 'Versioning' section in README file, this is compatible with Rails 3.2.x