Class: License

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

Instance Method Summary collapse

Instance Method Details

#describe_idObject



13
14
15
# File 'app/models/license.rb', line 13

def describe_id
  "License ##{id}"
end

#update_agent_licenseObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/models/license.rb', line 16

def update_agent_license
	if self.status == "Actived"

		agent = self.agent
		agent.licenses.where("id != ?",self.id).update_all("status ='Deactived'")
		agent.update_attributes({:license_number => self.license_number, :license_state_issued => self.license_state_issued,:license_issued_date => self.license_issued_date})
    agent.push_notification_change_license("approved")
    UserMailer.delay.send_license_status(agent,"approved")
  elsif self.status =="Deactived"
    agent = self.agent
    agent.push_notification_change_license("rejected")
    UserMailer.delay.send_license_status(agent,"rejected")
  end

end