Remove duplicated code.

inheritance that is already in place to define it just once.

Conditional in the method also make it easy to support rails 4.