|
1 | 1 | class User
|
2 | 2 | include Mongoid::Document
|
3 |
| - # Include default devise modules. Others available are: |
4 |
| - # :confirmable, :lockable, :timeoutable and :omniauthable |
5 |
| - devise :database_authenticatable, :recoverable, :rememberable, :trackable, |
6 |
| - :validatable |
| 3 | + include Mongoid::Paperclip |
| 4 | + include UserDevise # See this concern file for devise related fields |
| 5 | + has_mongoid_attached_file :profile_image |
7 | 6 |
|
8 |
| - ## Database authenticatable |
9 |
| - field :email, type: String, default: "" |
10 |
| - field :encrypted_password, type: String, default: "" |
| 7 | + %i( first_name |
| 8 | + last_name |
| 9 | + biography |
| 10 | + address_line_1 |
| 11 | + address_line_2 |
| 12 | + postal_code |
| 13 | + state_province |
| 14 | + country |
| 15 | + primary_phone ).each do |string_field| |
| 16 | + field string_field |
| 17 | + end |
11 | 18 |
|
12 |
| - ## Recoverable |
13 |
| - field :reset_password_token, type: String |
14 |
| - field :reset_password_sent_at, type: Time |
| 19 | + validates :first_name, :last_name, :email, presence: true |
15 | 20 |
|
16 |
| - ## Rememberable |
17 |
| - field :remember_created_at, type: Time |
18 |
| - |
19 |
| - ## Trackable |
20 |
| - field :sign_in_count, type: Integer, default: 0 |
21 |
| - field :current_sign_in_at, type: Time |
22 |
| - field :last_sign_in_at, type: Time |
23 |
| - field :current_sign_in_ip, type: String |
24 |
| - field :last_sign_in_ip, type: String |
25 |
| - |
26 |
| - ## Confirmable |
27 |
| - # field :confirmation_token, type: String |
28 |
| - # field :confirmed_at, type: Time |
29 |
| - # field :confirmation_sent_at, type: Time |
30 |
| - # field :unconfirmed_email, type: String # Only if using reconfirmable |
31 |
| - |
32 |
| - ## Lockable |
33 |
| - # field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts |
34 |
| - # field :unlock_token, type: String # Only if unlock strategy is :email or :both |
35 |
| - # field :locked_at, type: Time |
36 | 21 | end
|
0 commit comments