我尝试使用dry-validation
(https://github.com/dry-rb/dry-validation)。
但是我收到了Dry::Validation.Schema
的错误,无法做任何事情。
错误说;
Dry::Validation.Schema for undefined method `Schema' for Dry::Validation:Module
dry-validation
gem正确包含在内。
有什么想法吗?
[21] pry(main)> Dry::Validation.public_methods
=> [:Result,
:Predicate,
:pretty_print_cycle,
:module_exec,
:class_exec,
:module_eval,
:class_eval,
:included_modules,
:include?,
:name,
:ancestors,
:instance_methods,
:public_instance_methods,
:protected_instance_methods,
:private_instance_methods,
:constants,
:const_get,
:const_set,
:const_defined?,
:class_variables,
:remove_class_variable,
:class_variable_get,
:class_variable_set,
:class_variable_defined?,
:public_constant,
:private_constant,
:deprecate_constant,
:singleton_class?,
:method_defined?,
:mattr_reader,
:protected_method_defined?,
:private_class_method,
:mattr_writer,
:public_method_defined?,
:private_method_defined?,
:mattr_accessor,
:public_class_method,
:cattr_reader,
:cattr_writer,
:cattr_accessor,
:<,
:>,
:namespace_name,
:parent_name,
:local_constants,
:deprecate,
:qualified_const_defined?,
:qualified_const_get,
:psych_yaml_as,
:yaml_as,
:qualified_const_set,
:parent,
:remove_possible_method,
:pretty_print,
:<=>,
:<=,
:>=,
:==,
:===,
:delegate,
:prepend,
:redefine_method,
:freeze,
:inspect,
:attr_internal_reader,
:attr_internal_writer,
:attr_internal_accessor,
:attr_internal,
:methods_transplantable?,
:to_s,
:autoload,
:autoload?,
:parents,
:alias_method_chain,
:anonymous?,
:alias_attribute,
:instance_method,
:public_instance_method,
:reachable?,
:class_name,
:include,
:delay,
:delay_for,
:delay_until,
:sidekiq_delay,
:sidekiq_delay_for,
:sidekiq_delay_until,
:const_missing,
:guess_for_anonymous,
:unloadable,
:concerning,
:concern,
:`,
:to_yaml,
:to_yaml_properties,
:blank?,
:present?,
:to_json,
:psych_to_yaml,
:presence,
:deep_dup,
:acts_like?,
:duplicable?,
:try,
:try!,
:in?,
:presence_in,
:to_param,
:to_query,
:as_json,
:instance_values,
:instance_variable_names,
:to_json_with_active_support_encoder,
:to_json_without_active_support_encoder,
:with_options,
:html_safe?,
:deep_clone,
:dclone,
:pry,
:__binding__,
:pretty_print_instance_variables,
:pretty_print_inspect,
:require_dependency,
:require_or_load,
:load_dependency,
:to_ruby,
:to_v8,
:instance_of?,
:public_send,
:instance_variable_get,
:instance_variable_set,
:instance_variable_defined?,
:remove_instance_variable,
:private_methods,
:kind_of?,
:instance_variables,
:tap,
:define_singleton_method,
:suppress_warnings,
:is_a?,
:extend,
:silence_warnings,
:byebug,
:debugger,
:to_enum,
:enum_for,
:with_warnings,
:enable_warnings,
:silence_stderr,
:silence_stream,
:suppress,
:capture,
:quietly,
:silence,
:=~,
:!~,
:eql?,
:respond_to?,
:display,
:pretty_inspect,
:object_id,
:send,
:gem,
:method,
:public_method,
:singleton_method,
:nil?,
:hash,
:class,
:singleton_class,
:clone,
:dup,
:itself,
:taint,
:tainted?,
:untaint,
:untrust,
:trust,
:untrusted?,
:methods,
:protected_methods,
:frozen?,
:public_methods,
:singleton_methods,
:!,
:!=,
:__send__,
:equal?,
:instance_eval,
:instance_exec,
:__id__]
答案 0 :(得分:0)
我明确指定了宝石
'dry-validation', git: 'git://github.com/dry-rb/dry-validation.git', tag: 'v0.10.3'
然后运作。