Equivalent of add_to_base in validations?

2 views
Skip to first unread message

Felipe Coury

unread,
Nov 20, 2009, 7:05:27 PM11/20/09
to mongo...@googlegroups.com
Guys,

How you add custom errors that are not tied to a single document key to a document using MongoMapper? I have a custom validator and would like to invalidate the document as a whole, not a specific attribute. Is there such thing?

Thanks!

--
Felipe Gonçalves Coury
CTO, Webbynode - Serious hosting for Developers
http://webbynode.com

Latest from Twitter:


John Nunemaker

unread,
Nov 21, 2009, 1:03:40 AM11/21/09
to mongo...@googlegroups.com
There isn't a way right now. I noticed this the other day. Validatable needs to be tweaked probably to do that.

--
You received this message because you are subscribed to the Google
Groups "MongoMapper" group.
For more options, visit this group at
http://groups.google.com/group/mongomapper?hl=en?hl=en

Felipe Coury

unread,
Nov 21, 2009, 9:54:41 AM11/21/09
to mongo...@googlegroups.com
John,

Just found out how to do it:

errors.add(:base, "Your base message") 

;)

Adding an "add_to_base" method to RailsCompatibility module may be a good thing in the future, but I am set ;)

Thanks,

-- Felipe.
Reply all
Reply to author
Forward
0 new messages