新手问题 关于在 rails 库里使用 ruby gem 该怎么配置

a-wing · March 26, 2018 · Last by a-wing replied at March 27, 2018 · 1013 hits

我说的是这个库原本是 ruby 的。我想在 rails 里使用

我用的是 net-ssh

应该在 rails 初始化时 require 'net/scp'。在 rails 框架中应该写在那?

我尝试写在 boot.rb 里。然后处理 rails server 之外的都不好使了。。。。

加到 Gemfile。关于 Gemfile:http://bundler.io/

Reply to Rei

我加到 Gemfile 里的。没有用啊。文档上说 Gemfile 里的会自动加载,猜测应该是 Gemfile 里的包名和 require 到名不一样所致

Reply to Rei

刚刚发现了个神奇问题 gem 'net-ssh', :require => 'net/ssh' 正常导入 gem 'net-ssh', :require => 'net/scp' 找不到模块。。。

突然反应过来了。。。。。

a-wing closed this topic. 27 Mar 09:47
You need to Sign in before reply, if you don't have an account, please Sign up first.