Class: CustomerLocationAlert

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

Instance Method Summary collapse

Instance Method Details

#check_slot_validObject



17
18
19
20
21
22
23
24
25
26
# File 'app/models/customer_location_alert.rb', line 17

def check_slot_valid
	date = DateTime.now
	count_data = CustomerLocationAlert.where("time_expired > '#{date}' and user_id=#{self.user_id.to_i}").count
	
	if count_data >= 10
		self.errors.add(:base,"Too much alert") 
		return false 
	end
	return true
end

#describe_idObject



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

def describe_id
"CustomerLocationAlert ##{id}"
end