* Add missing presence validator for Tag * Add missing presence validators to Follow * Add missing presence validators to ProfileField * Add missing presence validators to Comment * Add missing presence validators to Profile * Add missing presence validators to Organization * Add missing presence validators to Badge * Add missing presence validators to Webhook::Endpoint * Add missing presence validators to NotificationSubscription * Add missing presence validators to PodcastEpisode * Add missing presence validators to Sponsorship * Add missing presence validators to PollOption * Add missing presence validators to Poll * Add missing presence validators to Article * Add missing presence validators to EmailAuthorization * Add missing presence validators to AuditLog * Add missing presence validators to DataUpdateScript * Add missing presence validators to User * Add missing presence validators to SiteConfig * Fix specs
28 lines
544 B
Ruby
28 lines
544 B
Ruby
class ProfileField < ApplicationRecord
|
|
include ActsAsProfileField
|
|
|
|
# Key names follow the Rails form helpers
|
|
enum input_type: {
|
|
text_field: 0,
|
|
text_area: 1,
|
|
check_box: 2,
|
|
color_field: 3
|
|
}
|
|
|
|
enum display_area: {
|
|
header: 0,
|
|
left_sidebar: 1
|
|
}
|
|
|
|
belongs_to :profile_field_group, optional: true
|
|
|
|
validates :display_area, presence: true
|
|
validates :input_type, presence: true
|
|
validates :show_in_onboarding, inclusion: { in: [true, false] }
|
|
|
|
def type
|
|
return :boolean if check_box?
|
|
|
|
:string
|
|
end
|
|
end
|