我在,進出口使用一個名爲「DataTableDelegate」類,這是在叫一個單獨的文件我「ProgramsController.rb」文件如下代碼:「datatable_delegate.rb」NameError - 在軌未初始化的恆定誤差4
# GET /programs
# GET /programs.json
def index
puts "Running Program/index"
puts "Model name = #{controller_name.classify}"
respond_to do |format|
format.html
@datatable_options = generate_datatable_hash(view_context, controller_name.classify, Program.data_table_attribute_array)
log_with_blue("============================================")
log_with_yellow("#{@datatable_options.inspect}")
log_with_blue("============================================")
>>>>>> format.json { render json: DataTableDelegate.new(@datatable_options) }
end
end
「datatable_delegate.rb」位於
app/datatables/datatable_delegate.rb
當我加載在瀏覽器中,我得到在我的日誌以下程序URL中的文件:
完成500 237ms
NameError - uninitialized constant ProgramsController::DataTableDelegate:
activesupport (4.0.0) lib/active_support/dependencies.rb:500:in `load_missing_constant'
activesupport (4.0.0) lib/active_support/dependencies.rb:183:in `const_missing'
app/controllers/programs_controller.rb:22:in `block (2 levels) in index'
actionpack (4.0.0) lib/action_controller/metal/mime_responds.rb:191:in `respond_to'
app/controllers/programs_controller.rb:13:in `index'
actionpack (4.0.0) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.0.0) lib/abstract_controller/base.rb:189:in `process_action'
......
我試圖把一個需要聲明,我的程序控制器文件,但我仍然正在錯誤.....
我應該怎麼辦?
謝謝