sane and automatic serialization for both rails3 and rails4