Module: Profileable
- Defined in:
- app/models/profileable.rb
Overview
This module allows to mark a model (User, Group, …) as profileable, i.e. have profile fields.
The inclusion of this module into ActiveRecord::Base is done in config/initializers/active_record_navable_extension.rb.
Defined Under Namespace
Modules: InstanceMethodsForProfileables
Instance Method Summary
collapse
Instance Method Details
#default_profile_section_titles ⇒ Object
21
22
23
24
|
# File 'app/models/profileable.rb', line 21
def default_profile_section_titles
[:contact_information, :about_myself, :study_information, :career_information,
:organizations, :bank_account_information, :description]
end
|
#has_profile_fields(options = {}) ⇒ Object
9
10
11
|
# File 'app/models/profileable.rb', line 9
def has_profile_fields( options = {} )
is_profileable(options)
end
|
#is_profileable(options = {}) ⇒ Object
13
14
15
16
17
18
19
|
# File 'app/models/profileable.rb', line 13
def is_profileable( options = {} )
@profile_section_titles = options[:profile_sections] || default_profile_section_titles
has_many :profile_fields, as: :profileable, dependent: :destroy, autosave: true
has_many :address_profile_fields, class_name: 'ProfileFieldTypes::Address', conditions: 'type = "ProfileFieldTypes::Address"', as: :profileable, dependent: :destroy, autosave: true
include InstanceMethodsForProfileables
end
|
#profile_section_titles ⇒ Object
25
26
27
|
# File 'app/models/profileable.rb', line 25
def profile_section_titles
@profile_section_titles
end
|