Class: IncomingReferer
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- IncomingReferer
- Defined in:
- app/models/incoming_referer.rb
Class Method Summary collapse
Class Method Details
.add!(opts) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/models/incoming_referer.rb', line 6 def self.add!(opts) domain_id = opts[:incoming_domain_id] domain_id ||= opts[:incoming_domain].id path = opts[:path] current = find_by(path: path, incoming_domain_id: domain_id) return current if current begin current = create!(path: path, incoming_domain_id: domain_id) rescue ActiveRecord::RecordNotUnique # does not matter end current || find_by(path: path, incoming_domain_id: domain_id) end |