我正在学习 Ruby 和 Devise,出于某种原因,未登录的用户不会被重定向到登录。
这是我的路线:
scope :module => :mobile, :as => :mobile do
constraints(:subdomain => /m/) do
devise_for :users, :path => "", :path_names => { :sign_in => "login", :sign_out => "logout", :sign_up => "signup" }, :controllers => {:sessions => "sidebar/sessions"}
resources :home
resources :disclosures # Will have new, get, look up a disclosure
devise_for :users, :path => "", :path_names =>
{ :sign_in => "login", :sign_out => "logout", :sign_up => "signup" }
end
end
这是我的控制器:
class Mobile::HomeController < ApplicationController
layout "mobile/application"
before_filter :authenticate_user!, :only => [:edit, :update, :destroy]
def index
respond_to do |format|
format.html
end
end
def create
end
end
知道为什么用户没有被重定向到登录吗?现在,用户只是被显示在他只能看到是否经过身份验证的页面。
谢谢!