0

我按照设计页面上的说明进行操作。唯一不同的是我正在自定义注册,他们的例子是关于会话的。

当我点击/users/sign_up页面时,设计正在使用Devise::RegistrationsController#new动作而不是new动作users_controller.rb

正如您从下面的服务器日志中XXXXXXXXXX\nxxxxxxxxxxx看到的那样,即使用户控制器具有以下new操作,也看不到puts "XXXXXXXXXX\nxxxxxxxxxxx"

Started GET "/users/sign_up" for 127.0.0.1 at 2012-10-14 03:29:52 -0700
Processing by Devise::RegistrationsController#new as HTML
  Rendered /Users/jasonkim/.rvm/gems/ruby-1.9.3-p0/gems/devise-2.1.2/app/views/devise/shared/_links.erb (0.4ms)
  Rendered users/registrations/new.html.haml within layouts/application (4.8ms)
Completed 200 OK in 88ms (Views: 12.3ms | ActiveRecord: 0.7ms)

users_controller.rb

class Users::RegistrationsController < Devise::RegistrationsController
  def new
    @user = User.new
    address = @user.address.build
    puts "XXXXXXXXXX\nxxxxxxxxxxx"
  end
end

路线.rb

devise_for :users, :controllers => { :registration => "users/registration" }
devise_for :employers

我在 devise.rb 中添加的唯一内容

config.scoped_views = true

我错过了什么?

4

1 回答 1

0

它应该是

devise_for :users, :controllers => { :registrationS => "users/registrationS" }

尾随's'(但当然是小写)

于 2012-10-14T10:51:54.910 回答