ruby on rails - Devise gives me an 'email cannot be blank' error even though email is not blank -


i doing 2 things user registration devise.

  1. two step confirmation - user required enter email address @ first.
  2. i have moved registration/new form welcome#index view.

even though correctly entered email address, , see included in params hash in log:

started post "/users" 127.0.0.1 @ 2012-06-05 20:35:43 -0500 processing devise::registrationscontroller#create 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 "users" 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) 

this error getting:

1 error prohibited user being saved: email can't blank 

my initial registration form looks this:

<%= form_for(resource, :as => resource_name, :class => "send-with-ajax", :url => user_registration_path(resource)) |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 %> 

thanks.

possible explanation:

your email field in params hash params[:email], while create action in controller expecting in params[:resource][:email]. when remove :name => :email assignment, email moves params[:resource][:email].

you have posted hash:

parameters: {"utf8"=>"✓", "authenticity_token"=>"0qwg/rxg+xydqdsdadww=", "email"=>"abc@test.com", "commit"=>"sign me up!"} 

can see difference in looks when works?


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -