User/Person models merge
This commit is contained in:
parent
66b84e3660
commit
23bf55b66c
80 changed files with 1064 additions and 1221 deletions
|
|
@ -1,13 +1,13 @@
|
|||
class SupporterRegistration < ActiveRecord::Base
|
||||
belongs_to :supporter_level
|
||||
belongs_to :registration
|
||||
before_save :set_attributes_from_person
|
||||
before_save :set_attributes_from_user
|
||||
|
||||
attr_accessible :registration, :supporter_level_id, :name, :email, :supporter_level, :code, :code_is_valid, :conference_id
|
||||
|
||||
def set_attributes_from_person
|
||||
self.name ||= registration.try(:person).try(:public_name)
|
||||
self.email ||= registration.try(:person).try(:email)
|
||||
def set_attributes_from_user
|
||||
self.name ||= registration.try(:user).try(:name)
|
||||
self.email ||= registration.try(:user).try(:email)
|
||||
true
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue