Add IBAN field to supplier and user model

This commit is contained in:
Patrick Gansterer 2017-01-18 11:12:56 +01:00 committed by wvengen
parent 925727d3ae
commit c6731b4e4f
12 changed files with 34 additions and 2 deletions

View file

@ -41,6 +41,8 @@ class User < ActiveRecord::Base
validates_length_of :nick, :in => 2..25, :allow_nil => true, :unless => Proc.new { FoodsoftConfig[:use_nick] }
validates_length_of :nick, :in => 2..25, :allow_nil => false, :if => Proc.new { FoodsoftConfig[:use_nick] }
validates_uniqueness_of :nick, :case_sensitive => false, :allow_nil => true # allow_nil in length validation
validates_format_of :iban, :with => /\A[A-Z]{2}[0-9]{2}[0-9A-Z]{,30}\z/, :allow_blank => true
validates_uniqueness_of :iban, :case_sensitive => false, :allow_blank => true
before_validation :set_password
after_initialize do