Ruby on rails Rails路由问题-未初始化常量游戏

Ruby on rails Rails路由问题-未初始化常量游戏,ruby-on-rails,routes,uninitialized-constant,Ruby On Rails,Routes,Uninitialized Constant,我的rails路由文件有问题。我的路由文件中有以下匹配项: match '/games/:game_id/increment_cool' => 'games/:game_id#increment_cool', :as => 'games_incrementcool' 然后,我尝试从我的游戏视图使用此路线,如下所示: <%= link_to 'Cool!', games_incrementcool_path(@game) %> 我尝试了许多不同的方法来实现这一点,但

我的rails路由文件有问题。我的路由文件中有以下匹配项:

  match '/games/:game_id/increment_cool' => 'games/:game_id#increment_cool', :as => 'games_incrementcool'
然后,我尝试从我的游戏视图使用此路线,如下所示:

<%= link_to 'Cool!', games_incrementcool_path(@game) %>
我尝试了许多不同的方法来实现这一点,但都没有成功


如何让视图在游戏控制器中调用increment_cool方法?提前谢谢

这就是匹配的工作方式:
match'/posts'=>“posts”#index'

第一个字符串是路由,第二个字符串是由#分隔的控制器/操作组合

'games#increment _cool'
表示
游戏
控制器的
increment _cool
动作

match'/games/:games\u id/increment\u cool'=>“games\35; increment\u cool',:as=>“games\u incrementcool”


尽管出于语义原因,您可能应该在
:as
选项中使用单数“game”,因为它使用的是单数资源。也许像
game\u increment\u cool
increment\u cool\u game

这样的东西不应该是game\u incrementcool\u路径吗?该错误表明RoR magic正在寻找一个游戏模型,而不是一个游戏模型。。
(in /home/sumdeos/RIT48/oneCoolGameADay)
                          profile_index GET    /profile/index(.:format)
                       new_user_session GET    /users/sign_in(.:format)
                           user_session POST   /users/sign_in(.:format)
                   destroy_user_session DELETE /users/sign_out(.:format)
                 user_omniauth_callback        /users/auth/:action/callback(.r)
                          user_password POST   /users/password(.:format)
                      new_user_password GET    /users/password/new(.:format)
                     edit_user_password GET    /users/password/edit(.:format)
                                        PUT    /users/password(.:format)
               cancel_user_registration GET    /users/cancel(.:format)
                      user_registration POST   /users(.:format)
                  new_user_registration GET    /users/sign_up(.:format)
                 edit_user_registration GET    /users/edit(.:format)
                                        PUT    /users(.:format)
                                        DELETE /users(.:format)
submitLeaderboardStatistic_game_leaderboard POST   /games/:game_id/leaderboards/:
                      game_leaderboards GET    /games/:game_id/leaderboards(.
                                        POST   /games/:game_id/leaderboards(.
                   new_game_leaderboard GET    /games/:game_id/leaderboards/n
                  edit_game_leaderboard GET    /games/:game_id/leaderboards/:
                       game_leaderboard GET    /games/:game_id/leaderboards/:
                                        PUT    /games/:game_id/leaderboards/:
                                        DELETE /games/:game_id/leaderboards/:
                                  games GET    /games(.:format)
                                        POST   /games(.:format)
                               new_game GET    /games/new(.:format)
                              edit_game GET    /games/:id/edit(.:format)
                                   game GET    /games/:id(.:format)
                                        PUT    /games/:id(.:format)
                                        DELETE /games/:id(.:format)
                    games_incrementcool        /game/:game_id/increment_cool(
                             home_index GET    /home/index(.:format)
                                   root        /