Commit e045c9426a89d563d76bfcbd5c922d197fd136fa
1 parent
71b019f0
Exists in
master
and in
20 other branches
rails4: fix foundation_year validation
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
app/models/organization.rb
@@ -112,7 +112,7 @@ class Organization < Profile | @@ -112,7 +112,7 @@ class Organization < Profile | ||
112 | 112 | ||
113 | settings_items :zip_code, :city, :state, :country | 113 | settings_items :zip_code, :city, :state, :country |
114 | 114 | ||
115 | - validates_numericality_of :foundation_year, only_integer: true, allow_nil: true | 115 | + validates_numericality_of :foundation_year, only_integer: true, if: -> o { o.foundation_year.present? } |
116 | validates_format_of :contact_email, :with => Noosfero::Constants::EMAIL_FORMAT, :if => (lambda { |org| !org.contact_email.blank? }) | 116 | validates_format_of :contact_email, :with => Noosfero::Constants::EMAIL_FORMAT, :if => (lambda { |org| !org.contact_email.blank? }) |
117 | validates_as_cnpj :cnpj | 117 | validates_as_cnpj :cnpj |
118 | 118 |