我在 Devise 的用户注册中做了两件事。
- 两步确认- 用户需要做的就是首先输入他们的电子邮件地址。
- 我已将注册/新表格移至我的
welcome#index
视图。
即使我正确输入了电子邮件地址,并且我看到它包含在params
日志的哈希中:
Started POST "/users" for 127.0.0.1 at 2012-06-05 20:35:43 -0500
Processing by Devise::RegistrationsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"0qWg/RxG+XyDqdsdadww=", "email"=>"abc@test.com", "commit"=>"Sign Me Up!"}
(0.1ms) begin transaction
User Exists (0.2ms) SELECT 1 FROM "users" WHERE LOWER("users"."email") = LOWER('') LIMIT 1
(0.1ms) rollback transaction
Rendered devise/registrations/new.html.erb within layouts/application (9.2ms)
Completed 200 OK in 65ms (Views: 54.9ms | ActiveRecord: 0.0ms)
这是我得到的错误:
1 error prohibited this user from being saved:
Email can't be blank
我的初始注册表如下所示:
<%= form_for(resource, :as => resource_name, :class => "send-with-ajax", :url => user_registration_path(resource)) do |f| %>
<%= devise_error_messages! %>
<%= f.email_field :email, :name => :email, :id => "form-email", :placeholder => "your-email@address.com", :input_html => {:autofocus => true} %>
<%= f.submit :label => "Submit", :value => "Sign Me Up!" %>
<% end %>
谢谢。