我开发了一个Rails项目,我想使用json-schema
gem。因此,我通过Gemfile
将其添加到了bundle add json-schema
中。但是,当我想通过运行rails console
我有这个经典错误
rails console
Running via Spring preloader in process 27970
Loading development environment (Rails 5.2.1)
2.5.1 :001 > require "json-schema"
Traceback (most recent call last):
1: from (irb):1
LoadError (cannot load such file -- json-schema)
我很确定正确安装了gem:
Gemfile
中有一行bundle info json-schema
* json-schema (2.8.0)
Summary: Ruby JSON Schema Validator
Homepage: http://github.com/ruby-json-schema/json-schema/tree/master
Path: /home/mcdostone/.rvm/gems/ruby-2.5.1/gems/json-schema-2.8.0
我尝试用irb
加载gem,并且效果完美。
任何知道rails怎么了吗?
答案 0 :(得分:0)
谢谢您 jvillian ,现在可以使用
我做了什么:
$ spring stop
$ rails c
Running via Spring preloader in process 31305
Loading development environment (Rails 5.2.1)
2.5.1 :001 > require "json-schema"
=> true