Hi all.

Just wondering if anyone has given any thought to a way to disable all
auto_validations for a model? It might be handy in alot of
circumstances rather than putting :auto_validation = false on every
property.

Something like the following?

class ValidateModel
  include DataMapper::Resource

  disable_auto_validations

  property :id, Serial
  property :name, String, :nullable => false
  ....
  ....
end

The other feature i was thinking about is dynamic message evaluation.
I ran into the problem where i needed the wording of the message to
change depending on the state of some other fields (the actual field
name was far too generic, designed to store a value which is slightly
differently worded in different contexts. Lets say there was a
reference model 'Period' which held Daily, Weekly, BiWeekly or Monthly
etc and some other model with a belongs_to on it

Being able to say the following would be nice

property :frequency, Integer, :nullable => false, :messages =>
{ :presence => lambda {"Cannot have empty value for #{reference.name}
status"} }

It might also be a fantastic help from a I18n point of view ??

Any thoughts on this?

Thanks!
Garrett
--~--~---------~--~----~------------~-------~--~----~
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