So it looks like I can make everything a String and use validatesnumericalityof, but then the database field will be primed for strings rather than numbers. I'd prefer not to do that if possible.
For those using DataMapper with Rails, I would love some insight into how you handle this. I imagine this is fairly common. Thanks. On Jan 16, 3:11 am, Neil Chaudhuri <[email protected]> wrote: > My entity has some attributes of type Integer, but they are not > required. So it is often possible that a form will submit empty > strings for these values to my controller. When I pass these empty > strings on to DataMapper, I get the "[Attribute] must be an integer" > message. I was curious if there is any built-in way I can tell > DataMapper to ignore type validation on blank values. > > Or must I write a custom validation? The ones I have tried so far > haven't worked, so if that is the way to go, I would love an example. > > Thanks. -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.
