Skip to content

Commit

Permalink
only validate birth_date when user account_type is pf
Browse files Browse the repository at this point in the history
  • Loading branch information
devton committed Mar 8, 2017
1 parent 0345263 commit 6fd7a77
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions .python-version
@@ -0,0 +1 @@
2.7.10
2 changes: 1 addition & 1 deletion app/models/user.rb
Expand Up @@ -31,7 +31,7 @@ class User < ActiveRecord::Base
mount_uploader :cover_image, CoverUploader

validates :bank_account, :name, :about_html, :public_name, :cpf, :address_zip_code, :phone_number, :address_state, :country_id, :address_city, :address_street, :address_number, :address_neighbourhood, presence: true, if: -> (user) { user.published_projects.present? || user.publishing_project }
validates :birth_date, presence: true, if: -> (user) { user.publishing_project }
validates :birth_date, presence: true, if: -> (user) { user.publishing_project && user.account_type == 'pf' }


validates_presence_of :email
Expand Down

0 comments on commit 6fd7a77

Please sign in to comment.