use before_format hook.