我使用腳手架創建了CRUD。ActiveRecord RecordNotFound錯誤
rails g scaffold intermediate_level/memory_game
然後我創建的方法玩,但是當我調用該方法起到返回一個錯誤。 http://localhost:3000/intermediate_level/memory_game/play?id=1
Couldn't find IntermediateLevel::MemoryGame with 'id'=play
# Use callbacks to share common setup or constraints between actions.
def set_intermediate_level_memory_game
@intermediate_level_memory_game = IntermediateLevel::MemoryGame.find(params[:id])
end
def play {
@intermediate_level_memory_game = IntermediateLevel::MemoryGame.find(params[:id])
}
我routes.file
namespace :intermediate_level do
resources :memory_game
get 'memory_game/play'
end
謝謝,正是這樣! –