3
我在/ lib目錄路由錯誤「未初始化的常量信息」
Module Info
class Inf
def getNum
num = Array.new
num.push(2,1)
end
end
在informations_controller我有「要求信息」控制器模塊和後續代碼:
def index
@informations = Info::Inf.getNum().num
respond_to do |format|
format.html # index.html.erb
format.json { render json: @informations }
end
end
但它總是給錯誤
Routing Error
uninitialized constant Info
由於路由器我已經定義了「root:to =>'信息#index'」有什麼可能會丟失?
你的模塊文件是否確實有'Module Info'(大寫M)? –
而且它真的沒有'結束' –
是的,你們倆都是對的!謝謝 –