Validate data in ruby