あるアクションが完了したら、別のURLにリダイレクトする処理をメモ。
top_controller.rbを以下のようにする
def goto
redirect_to :action => 'about'
end
保存後、gotoというアクションを実行すると、aboutへ移動
----------------------
コントローラーやパラメータ, URLを指定することも可能。
redirect_to :controller => 'test', :action => 'hoge'
redirect_to :action => 'about', :id => id
redirect_to 'http://google.co.jp'
top_controller.rbを以下のようにする
def goto
redirect_to :action => 'about'
end
保存後、gotoというアクションを実行すると、aboutへ移動
----------------------
コントローラーやパラメータ, URLを指定することも可能。
redirect_to :controller => 'test', :action => 'hoge'
redirect_to :action => 'about', :id => id
redirect_to 'http://google.co.jp'