これを修正するには、config.rb に何を追加する必要がありますか。
私のレールに関する非常に限られた知識で、このメソッドをコントローラーに入れることができました。
def reset
Player.each do |p|
p.playing = false
p.save
end
end
ビューでこのリンクを作成します
<p><%= link_to "New Game", {:action => 'reset' }%></p>
私がすでに持っているものを詰め込むことなく、これを機能させるためにroutes.rbに何を入れればよいのかわかりません。
これは私のconfig.rbです
ChooseTeams3::Application.routes.draw do
resources :players
root :to => "players#index"
get "/index" => "players#index"
end
レーキ ルートを入力すると、これが表示されます
rake routes
players GET /players(.:format) players#index
POST /players(.:format) players#create
new_player GET /players/new(.:format) players#new
edit_player GET /players/:id/edit(.:format) players#edit
player GET /players/:id(.:format) players#show
PUT /players/:id(.:format) players#update
DELETE /players/:id(.:format) players#destroy
root / players#index
index GET /index(.:format) players#index