Fixing and testing proxyable with associations and validation

This commit is contained in:
Sam Lown 2011-04-05 20:41:24 +02:00
parent 8fa7e87019
commit 760d855845
10 changed files with 135 additions and 102 deletions

View file

@ -16,7 +16,7 @@ module CouchRest
def validate_each(document, attribute, value)
view_name = options[:view].nil? ? "by_#{attribute}" : options[:view]
model = (respond_to?(:model_proxy) && model_proxy ? model_proxy : @model)
model = (document.respond_to?(:model_proxy) && document.model_proxy ? document.model_proxy : @model)
# Determine the base of the search
base = options[:proxy].nil? ? model : document.instance_eval(options[:proxy])