"no such file to download - net / ssh" from rails Controller on Ubuntu

I have a very simple controller:

require 'net/ssh'

class MyController < ApplicationController
    def foo
        render :text => 'bar'
    end
end

But when I request http: // server: 3000 / my / foo , I get:

MissingSourceFile in MyController#foo 
no such file to load -- net/ssh

Stone set

> gem list net-ssh

*** LOCAL GEMS ***
net-ssh (2.0.11)

Also, I tried to use "net / ssh" in IRB and it works.

MyController works fine on Windows, but not on Ubuntu.

What could be wrong?

+1
source share
6 answers
+1
source

, , config/environment.rb , . ,

Rails::Initializer.run do |config|
  # ...
  config.gem 'net-ssh'
  config.gem 'daemons'
  config.gem 'slave'
  config.gem 'vpim'
  config.gem 'json'
  # ...
end

, "net-ssh", "net/ssh". , .

  config.gem 'Ruby-IRC', :lib => 'IRC'

, , .

  config.gem 'net-ssh', :lib => 'net/ssh'
+3

3.0 , . yourapp/Gemfile,

gem 'net-ssh
+2

, ruby, .

+1

You can also use Dr Nic `` gemsonrails '' and download sold gems as plugins, check out: http://gemsonrails.rubyforge.org

0
source

I think the original problem was that instead of a regular user, I used a regular user:

$ gem install net-ssh
  WARNING:  Installing to ~/.gem since /usr/lib/ruby/gems/1.8 and
            /usr/bin aren't both writable.
  WARNING:  You don't have /home/alex/.gem/ruby/1.8/bin in your PATH,
            gem executables will not run.

So, I think the rails could not find this stone.

0
source

Source: https://habr.com/ru/post/1721042/


All Articles