私はRuby on Railsを学ぼうとしており、コードの一部を手で書いて、それがどのように機能するかを学ぼうとしています.
私はこの小さなコントローラーを作りました:
class TestsController < ApplicationController
def test
def show
render :text => "Hi from TestsController!"
end
end
end
そして、これが私の見解に残っているものです:
<h3> Hello test </h3>
これは私のroutes.rbスニペットです:
resource :test
しかし、次のエラーが発生します。The action 'show' could not be found for TestsController
ありがとう!
これは rake ルートの出力です:
home_index GET /home/index(.:format) home#index
root / home#index
test POST /test(.:format) tests#create
new_test GET /test/new(.:format) tests#new
edit_test GET /test/edit(.:format) tests#edit
GET /test(.:format) tests#show
PUT /test(.:format) tests#update
DELETE /test(.:format) tests#destroy