Improving handling of mime types, instanciation of documents from the

database, and more dependencies on active_support.
This commit is contained in:
Sam Lown 2010-05-12 23:43:17 +02:00
parent 303f0cd1cf
commit b0d2258bd3
11 changed files with 69 additions and 57 deletions

View file

@ -60,7 +60,7 @@ module CouchRest
cattr_writer :default_error_messages
def self.default_error_message(key, field, *values)
field = CouchRest.humanize(field)
field = field.to_s.humanize
@@default_error_messages[key] % [field, *values].flatten
end

View file

@ -64,7 +64,7 @@ module CouchRest
error_message = @options[:message] || ValidationErrors.default_error_message(:invalid, field_name)
field = CouchRest.humanize(field_name)
field = field_name.to_s.humanize
error_message = error_message.call(field, value) if error_message.respond_to?(:call)
add_error(target, error_message, field_name)

View file

@ -54,7 +54,7 @@ module CouchRest
# XXX: HACK seems hacky to do this on every validation, probably should
# do this elsewhere?
field = CouchRest.humanize(field_name)
field = field_name.to_s.humanize
min = @range ? @range.min : @min
max = @range ? @range.max : @max
equal = @equal