Hey all, I'm trying to integrate SimpleForm's validation reflection with 
DataMapper and I've hit a tiny wall.

Basically I am trying to get the dm equivalent of this ActiveRecord method:

Person.validators_on(:name)

And that is proving to be a challenge because in datamapper all we get is 
the validators method, a class which contains an array of validations:

*Person.validators*
*=> #<DataMapper::Validations::ContextualValidators:0x0000010204e360 
@contexts={:default=>[...validations here...]*

I can access that array like this: *Site.validators.contexts[:default]*

But as far as accessing all validations for a given attribute, I'm plain 
stumped. Maybe if it was a hash I could pull it off by accessing keys, but 
since it's an array I am at a loss as to how I can query for the relevant 
validations.

Any ideas? Is there an easier method for doing this that I've missed?


-- 
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.

Reply via email to