我在捆绑安装后尝试在我的rails应用程序中运行rake db:reset
。显示以下消息
rake aborted!
cannot load such file -- indirizzo
/home/xyz/Desktop/Signup4/app/models/concerns/address_validation.rb:2:in `<module:AddressValidation>'
/home/xyz/Desktop/Signup4/app/models/concerns/address_validation.rb:1:in `<top (required)>'
/home/xyz/Desktop/Signup4/app/models/location.rb:2:in `<class:Location>'
/home/xyz/Desktop/Signup4/app/models/location.rb:1:in `<top (required)>'
/home/xyz/Desktop/Signup4/db/seeds.rb:11:in `<top (required)>'
Tasks: TOP => db:setup => db:seed
(See full trace by running task with --trace)
bundle show Indirizzo
显示
/usr/local/lib/ruby/gems/2.0.0/gems/Indirizzo-0.1.7
答案 0 :(得分:2)
在我看来问题是正确的require
。
根据自述文件https://github.com/daveworth/Indirizzo#usage,它应该是
require 'Indirizzo'
但事实上它不起作用(同样的错误)。
它认为它应该与内部lib https://github.com/daveworth/Indirizzo/blob/master/lib/indirizzo.rb
中的相同require 'indirizzo/address'
在此之后,我设法完成此示例Indirizzo::Address.new("some address")