레일 경로 파일에 문제가 있습니다. 나는 나의 루트 파일에 다음 경기가 :레일 라우팅 문제 - 초기화되지 않은 상수 게임
<%= link_to 'Cool!', games_incrementcool_path(@game) %>
을하지만 라우팅 오류 uninitialized constant Games
를 수신하고 있습니다 :
match '/games/:game_id/increment_cool' => 'games/:game_id#increment_cool', :as => 'games_incrementcool'
그때 내 게임과 같이 볼에서이 경로를 사용하려고합니다.
레이크 노선이를 보여줍니다
(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 /
내가이 일을하기 위해 다양한 방법을 시도했지만, 그들 중 누구도 일을 없다.
내 게임 컨트롤러에서 increment_cool 메서드를 호출하기 위해 뷰를 가져올 수 있습니까? 미리 감사드립니다!
game_incrementcool_path가되어야하지 않습니까? 오류는 RoR 마술이 게임 모델 대신 게임 모델을 찾고 있음을 나타냅니다. –