Extract humanize method from Extlib::Inflection to CouchRest.humanize, so that Extlib::Inflection dependency can be removed
This commit is contained in:
parent
ef8933432a
commit
d9417f3915
4 changed files with 15 additions and 3 deletions
|
@ -60,7 +60,7 @@ module CouchRest
|
|||
cattr_writer :default_error_messages
|
||||
|
||||
def self.default_error_message(key, field, *values)
|
||||
field = Extlib::Inflection.humanize(field)
|
||||
field = CouchRest.humanize(field)
|
||||
@@default_error_messages[key] % [field, *values].flatten
|
||||
end
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ module CouchRest
|
|||
|
||||
error_message = @options[:message] || ValidationErrors.default_error_message(:invalid, field_name)
|
||||
|
||||
field = Extlib::Inflection.humanize(field_name)
|
||||
field = CouchRest.humanize(field_name)
|
||||
error_message = error_message.call(field, value) if error_message.respond_to?(:call)
|
||||
|
||||
add_error(target, error_message, field_name)
|
||||
|
|
|
@ -54,7 +54,7 @@ module CouchRest
|
|||
|
||||
# XXX: HACK seems hacky to do this on every validation, probably should
|
||||
# do this elsewhere?
|
||||
field = Extlib::Inflection.humanize(field_name)
|
||||
field = CouchRest.humanize(field_name)
|
||||
min = @range ? @range.min : @min
|
||||
max = @range ? @range.max : @max
|
||||
equal = @equal
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue