LocalCensus model created

This commit is contained in:
María Checa
2017-07-08 19:56:10 +02:00
parent d31e0ed79b
commit feff9fff0f
6 changed files with 47 additions and 3 deletions

View File

@@ -32,6 +32,7 @@ class User < ActiveRecord::Base
has_many :direct_messages_received, class_name: 'DirectMessage', foreign_key: :receiver_id
has_many :legislation_answers, class_name: 'Legislation::Answer', dependent: :destroy, inverse_of: :user
belongs_to :geozone
belongs_to :local_census_record
validates :username, presence: true, if: :username_required?
validates :username, uniqueness: { scope: :registering_with_oauth }, if: :username_required?