> Did you remember to set "config.authentication_keys = [:username]" in
> the initializer? Show us at least the non-commented-out lines.
$ grep -v \# config/initializers/devise.rb |grep .
Devise.setup do |config|
config.mailer_sender = "password_reset@gloryhouseofprayer.com"
require 'devise/orm/active_record'
config.case_insensitive_keys = [ :username ]
config.strip_whitespace_keys = [ :username ]
config.stretches = Rails.env.test? ? 1 : 10
config.use_salt_as_remember_token = true
config.timeout_in = 30.minutes
config.reset_password_within = 2.hours
config.sign_out_via = :get
config.authentication_keys = [ :username ]
config.reset_password_keys = [ :username ]
config.confirmation_keys = [ :username ]
end
> That sounds like you may be pulling out the wrong part of the params.
> Can you show us the controller action and logged params? Or are you
> just using the default Devise controllers?
I apologize if I'm not following you, because I'm new to Ruby on Rails,
but Devise didn't install any Controller, nor did it add anything to the
default app/controller/application_controller.rb. So, I assume I'm
using the default. However I did add an entry to my application's
controller so I could authenticate before going to any page:
$ cat app/controllers/my_app_controller.rb
class MyAppController < ApplicationController
before_filter :authenticate_user!
...
When I was looking through the logs (to respond to your "logged params"
question I found this error:
"Started POST "/users" for 127.0.0.1 at 2013-06-25 19:29:41 -0400
Processing by Devise::RegistrationsController#create as HTML
Parameters: {"utf8"=>"✓",
"authenticity_token"=>"tltbt2w5FkZQbkbLqYaZIPiqk3J7VsdQIvKWFDCYLAs=",
"user"=>{"firstname"=>"bob", "lastname"=>"smith",
"password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"},
"commit"=>"Sign up"}
WARNING: Can't mass-assign protected attributes for User: password"
So, I googled it and saw references to removing the "attr_protected
:password" from the model (user.rb).
I did that and now only get the "Email can't be blank" error when trying
to sign up a user.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4e49e642005b655e86bf73c4271b36d2%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment