Tushar Patil
2013-Aug-07 08:19 UTC
How to allow email blank in user table which is created using devise and cancan.
I have a *user mode*l in which *username* and* email* field, i am login with username when i am creating user i want it''s email may be blank, but when i am register user from another model it gives error *User email can''t be blank*. I already make changes email field in confgi/devise.rb, but it doesn''t work. Here is My *User model* *class User < ActiveRecord::Base* has_and_belongs_to_many :roles devise :database_authenticatable, :registerable, :rememberable, :token_authenticatable, :trackable, :validatable, :timeoutable ,:lockable, :recoverable , :authentication_keys => [:username] attr_accessible :email, :username, :password, :password_confirmation, :remember_me, :role_ids, :roles validates :email , :presence => false *end* Please, let me know where i am wrong. Thanks, Tushar Patil. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAMFjjReXVW4_vkrp%3DBfXZ0HK8nDfKPpiTP6hMGCqxUXa7Wu3vQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Sushil Damdhere
2013-Aug-07 11:42 UTC
Re: How to allow email blank in user table which is created using devise and cancan.
This thread may help you out http://stackoverflow.com/questions/11678508/email-cant-be-blank-devise-using-username-or-email On Wed, Aug 7, 2013 at 1:49 PM, Tushar Patil <tushar01patil-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> I have a *user mode*l in which *username* and* email* field, i am login > with username when i am creating user i want it''s email may be blank, but > when i am register user from another model it gives error *User email > can''t be blank*. > I already make changes email field in confgi/devise.rb, but it doesn''t > work. > > Here is My *User model* > > *class User < ActiveRecord::Base* > > has_and_belongs_to_many :roles > > devise :database_authenticatable, :registerable, :rememberable, > :token_authenticatable, :trackable, > :validatable, :timeoutable ,:lockable, :recoverable , > :authentication_keys => [:username] > > attr_accessible :email, :username, :password, :password_confirmation, > :remember_me, :role_ids, :roles > validates :email , :presence => false > *end* > Please, let me know where i am wrong. > > Thanks, > Tushar Patil. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/CAMFjjReXVW4_vkrp%3DBfXZ0HK8nDfKPpiTP6hMGCqxUXa7Wu3vQ%40mail.gmail.com > . > For more options, visit https://groups.google.com/groups/opt_out. > > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAPSjBZcVY1eeffDvi6pUEVUG%2BkE59qVjKahc7gB7yGotJ6DBpg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.