比赛系统创建驱动程序

时间:2018-04-17 03:33:56

标签: ruby-on-rails ruby drivers tournament

现在通过添加require 'tournament_system'修复了错误,这是我的新错误:

这是终端:

  Rendering html template
  Rendered html template (0.0ms)
  Rendered tourneys/index.html.erb within layouts/application (10.8ms)
Completed 401 Unauthorized in 16ms (Views: 0.3ms | ActiveRecord: 1.1ms)



RuntimeError - Not Implemented:
  app/controllers/tourneys_controller.rb:77:in `tourn'
  app/views/tourneys/index.html.erb:37:in `_app_views_tourneys_index_html_erb__1482772099755741577_70314301318160'

Started POST "/__better_errors/deabb75178ea93ac/variables" for ::1 at 2018-04-17 00:55:03 -0700

这是在网页上

Not Implemented

tournapp/controllers/tourneys_controller.rb
72
73
74
75
76
77
78
79
80
81
82
  def tourn
    driver = Driver.new
   # Generate a round of a single elimination tournament
    TournamentSystem::SingleElimination.generate driver
    #Challonge::Tournament.find(:all)
    #@teamArray2 = render html: "<div>#{Challonge::Tournament.find(:all)}</div>".html_safe
  end
>>
 This is a live shell. Type in here.
Request info
Request parameters  
{"controller"=>"tourneys", "action"=>"index"}
Rack session    
(object too large. Modify ActionDispatch::Request::Session#inspect or increase BetterErrors.maximum_variable_inspect_size)
Local Variables
driver  
#<Driver:0x00007fe6a4eba5e0>

我认为错误与未正确调用驱动程序有关。我还使用脚手架创建了控制器Tourney。

1 个答案:

答案 0 :(得分:0)

您的Class Driver来自TournamentSystem::Driver,但该模块无法使用,因为没有明确要求。

添加require 'tournament_system'应该注意这一点。

关于NotImplemented错误,这与您的代码无关。如果您遵循def generatesource code)中module SingleElimination的源代码并遍历:

def generate调用create_matches,调用create_match,最终调用build_match并且raise 'Not Implemented'

项目的开发人员尚未完成所有必需的功能。