我希望在應用程序/公用文件夾中對index.html進行重定向。如何重定向到root - public/index.html?
def get_current_user
@current_user = current_user
if @current_user.nil?
redirect_to root_path
end
end
我該如何做到這一點?
我還沒有在我的routes.rb中修改根目錄(它仍然註釋)
# root :to => "welcome#index"
我得到一個錯誤說root_path是不確定的。
如何修改routes.rb以便root_path指向public/index.html?
而不是使用'root_path',使用'redirect_to'/'' – meagar 2011-06-06 20:19:51
@meagar這是答案,而不是評論,那麼爲什麼不直接創建答案而不是評論問題呢? – MBO 2011-06-06 20:21:46
@MBO這不是一個答案。問題是「我該如何做X?」而我的評論是「不要,反而是Y」。這不是一個可以接受的答案IMO,我會低估其他人張貼它。 – meagar 2011-06-06 20:23:14