Class: Divert::Redirect
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Divert::Redirect
- Defined in:
- app/models/divert/redirect.rb
Class Method Summary collapse
-
.hit(path) ⇒ Object
Class Methods.
Instance Method Summary collapse
- #hit ⇒ Object
-
#name ⇒ Object
Instance Methods.
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
#hit ⇒ Object
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 |
#name ⇒ Object
Instance Methods
7 8 9 |
# File 'app/models/divert/redirect.rb', line 7 def name "\"#{hither}\" > \"#{thither}\"" end |