improve rails validations and associations