私はコントローラーを持っておりtest_controller、このコントローラーにtestはindex.html.erb. インデックスは /test/ からアクセスできます。
ここで、このコントローラーに新しいビュー ファイルを追加したいと考えています (そのため、それに設定されている変数にアクセスできます) hello.html.erb。testindex.htlm.erb と同じビュー フォルダーに配置します。
私の現在のroutes.rbエントリは次のようになります。
scope "/test/" do
match "/hello" => "test#hello", :controller => "test"
match "/" => 'test#index'
end
呼び出すことはできます/test/helloが、test_controller から変数にアクセスできません。これはなぜですか、どうすれば修正できますか?
編集:
test_controller次のようになります。
class TestController < ApplicationController
layout 'test'
def index
@error_logs = Error.order('creationTimestamp DESC')
end
そしてビューからアクセス@error_logsしたい。hello