Class: Effective::Representative

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/effective/representative.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#new_representative_user_actionObject

Returns the value of attribute new_representative_user_action.



5
6
7
# File 'app/models/effective/representative.rb', line 5

def new_representative_user_action
  @new_representative_user_action
end

Instance Method Details

#build_organization(attributes = {}) ⇒ Object



53
54
55
56
# File 'app/models/effective/representative.rb', line 53

def build_organization(attributes = {})
  raise('please assign organization_type first') if organization_type.blank?
  self.organization = organization_type.constantize.new(attributes)
end

#build_user(attributes = {}) ⇒ Object



48
49
50
51
# File 'app/models/effective/representative.rb', line 48

def build_user(attributes = {})
  raise('please assign user_type first') if user_type.blank?
  self.user = user_type.constantize.new(attributes)
end

#to_sObject



44
45
46
# File 'app/models/effective/representative.rb', line 44

def to_s
  user&.to_s || model_name.human
end