docbrown/app/models/profile_field.rb
Michael Kohl 4ae59b56e3
Add custom profile fields (#10202)
* Add custom_profile_fields table

* Add CustomProfileField model and refactor

* Remove trailing whitespace

* Stop ignoring removed column

* Add explanatory comment

* Update service object

* Fix bug in service object

* Refactor and fix specs

* Increase limit from 3 to 5

* Update comment to reflect code changes
2020-09-09 14:37:15 +00:00

26 lines
462 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 :show_in_onboarding, inclusion: { in: [true, false] }
def type
return :boolean if check_box?
:string
end
end