fix new user form
This commit is contained in:
parent
9ba425aafa
commit
e13ca74df3
2 changed files with 5 additions and 4 deletions
|
@ -27,8 +27,8 @@ class User < ActiveRecord::Base
|
|||
|
||||
validates_presence_of :email
|
||||
validates_presence_of :password, :on => :create
|
||||
validates_length_of :nick, :in => 2..25, :allow_nil => true
|
||||
validates_uniqueness_of :nick, :case_sensitive => false, :allow_nil => true
|
||||
validates_length_of :nick, :in => 2..25, :allow_nil => !FoodsoftConfig[:use_nick]
|
||||
validates_uniqueness_of :nick, :case_sensitive => false, :allow_nil => !FoodsoftConfig[:use_nick]
|
||||
validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
|
||||
validates_uniqueness_of :email, :case_sensitive => false
|
||||
validates_length_of :first_name, :in => 2..50
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
- unless FoodsoftConfig[:use_nick] == false
|
||||
= f.input :nick
|
||||
- if FoodsoftConfig[:use_nick]
|
||||
-# use_nil option to user model validators break required mark
|
||||
= f.input :nick, required: true
|
||||
= f.input :first_name
|
||||
= f.input :last_name
|
||||
= f.input :email
|
||||
|
|
Loading…
Reference in a new issue