rolling back transaction on registration with Devise

783 views
Skip to first unread message

Prizefighter

unread,
Jun 27, 2013, 10:51:42 AM6/27/13
to plataforma...@googlegroups.com

Hi, I'm having difficulty setting up Devise. I'm following Ryan Bates tutorial for Devise with Twitter authentication but in Rails 4. . I can login with Twitter but I can't register with Devise alone (i.e. without using Twitter). I'm getting an unpermitted parameters error with the name field, even though I have the following code in my application controller


  def configure_permitted_parameters
    devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:name, :email, :provider, :image, :password, :password_confirmation) }
    devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:name, :email, :provider, :image, :password, :password_confirmation) }
  end

And even if I remove the name field from the sign up form (i.e. just sign up with email and password), it's rolling back the transaction.

Can anyone explain what I might be doing wrong?



Started POST "/users" for 127.0.0.1 at 2013-06-27 07:45:53 -0700
Processing by RegistrationsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"jlbhkdXuRjChKXJltoemYnuOGtyfAoEgGobdPf1LB7Q=", "user"=>{"email"=>"skan...@gmail.com", "name"=>"skankyguy", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up"}
Unpermitted parameters: name
   (1.5ms)  BEGIN
  User Exists (0.4ms)  SELECT 1 AS one FROM "users" WHERE "users"."email" = 'skan...@gmail.com' LIMIT 1
  User Exists (0.4ms)  SELECT 1 AS one FROM "users" WHERE "users"."name" IS NULL LIMIT 1
  User Exists (0.5ms)  SELECT 1 AS one FROM "users" WHERE LOWER("users"."email") = LOWER('skan...@gmail.com') LIMIT 1
   (0.7ms)  ROLLBACK
  Rendered devise/registrations/_navigation.html.erb (0.6ms)
  Rendered devise/shared/_links.erb (1.4ms)
  Rendered devise/registrations/new.html.erb within layouts/application (21.9ms)
Completed 200 OK in 193ms (Views: 59.5ms | ActiveRecord: 3.5ms)

Vasiliy Ermolovich

unread,
Jun 27, 2013, 1:37:28 PM6/27/13
to plataforma...@googlegroups.com
Hi,

Are you sure you don't forget about before filter in application controller?

before_filter :configure_permitted_parameters, if: :devise_controller?


Prizefighter wrote:
--

---
You received this message because you are subscribed to the Google
Groups "Devise" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to plataformatec-de...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages