アクションでインスタンス変数を定義すると、同じコントローラーに属する他のアクション内では使用できませんか?
インスタンス変数は、クラス全体で使用できる必要があります。右?
class DemoController < ApplicationController
def index
#render('demo/hello')
#redirect_to(:action => 'other_hello')
end
def hello
#redirect_to('http://www.google.co.in')
@array = [1,2,3,4,5]
@page = params[:page].to_i
end
def other_hello
render(:text => 'Hello Everyone')
end
end
インデックスで配列を定義し、helloビューからアクセスすると、nilのfalse値に対してエラーが発生するのはなぜですか?