Implement personal profile building for User

This commit is contained in:
Petko Bordjukov 2015-08-15 01:57:17 +03:00
parent 2203aee1d5
commit 173f251148
1 changed files with 5 additions and 3 deletions

View File

@ -9,9 +9,11 @@ class User < ActiveRecord::Base
has_many :workshops
has_many :events
# TODO (2015-08-05) Copy previous profile
def build_personal_profile(conference, params)
personal_profiles.build({conference_id: conference.id}.merge(params))
def build_personal_profile(conference, params = {})
new_personal_profile = personal_profiles.last.dup || personal_profiles.build
new_personal_profile.conference = conference
new_personal_profile.assign_attributes params
new_personal_profile
end
def personal_profile(conference)