compatible to ruby 2.0 and rails 3.x