Class: Divert::Redirect

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.hit(path) ⇒ Object

Class Methods



18
19
20
21
# File 'app/models/divert/redirect.rb', line 18

def self.hit path
  path.chomp! '/'
  find_or_create_by(hither: path).hit
end

Instance Method Details

#hitObject



11
12
13
14
15
# File 'app/models/divert/redirect.rb', line 11

def hit
  return nil unless active
  increment! :hits unless thither
  thither
end

#nameObject

Instance Methods



7
8
9
# File 'app/models/divert/redirect.rb', line 7

def name
  "\"#{hither}\" > \"#{thither}\""
end