我的ruby
应用中有一个课程,我们称之为ping
我把这个类放在app/helpers
文件夹中。我正在尝试使用此代码将此类需要到我的控制器:
require '../helpers/ping'
class PingController < ApplicationController
def index
end
end
但问题是,当我加载索引视图时,它会抱怨错误:
cannot load such file -- ../helpers/ping
我该如何解决?
答案 0 :(得分:0)
在没有文件路径的情况下尝试以下操作:
require 'ping'
OR
require_relative 'helpers/ping'