fix duration for rails 4