Simplify active record macro usage and make it compatible with Rails 3.x and 4.x. Fix bug for STI models being rated