【发布时间】:2015-11-17 11:36:36
【问题描述】:
我正在使用 Rails 4 并希望有一个登录页面,用户可以选择登录或注册。我目前遇到的问题是路线不断将我引导回登录。
路线
Rails.application.routes.draw do
get 'home/index'
root 'home#index'
devise_for :people
家庭控制器
class HomeController < ApplicationController
skip_before_action :authenticate_user!
def index
end
end
人员控制器
class PeopleController < ApplicationController
before_filter :set_person, only: [:show, :edit, :update, :destroy]
before_filter :authenticate_person!
respond_to :html
终端输出
Started GET "/" for 127.0.0.1 at 2015-11-17 22:28:51 +1100
ActiveRecord::SchemaMigration Load (0.7ms) SELECT "schema_migrations".* FROM "schema_migrations"
Processing by HomeController#index as HTML
Completed 401 Unauthorized in 20ms (ActiveRecord: 0.0ms)
【问题讨论】:
标签: ruby-on-rails ruby devise routes