Deviseでユーザ名だけで使うときに「Email can't be blank」とか言われちゃう場合の対処。
I thoght to use Devise only UserName.
But there are two problems.
So, Modify the Model.rb as follows. (my model name is "Users")
class User < ActiveRecord::Base ................. # Setup accessible (or protected) attributes for your model attr_accessible :email, :password, :password_confirmation, :remember_me ,:username # Email is not required def email_required? false end end
- Add -username to attr_accessible.
- Override the method 'email_required?