Class: Divert::Redirect
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Divert::Redirect
- Defined in:
- app/models/divert/redirect.rb
Constant Summary collapse
- ANTISLASH =
/^\/|\/\s*$/
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
26 27 28 29 30 31 |
# File 'app/models/divert/redirect.rb', line 26 def self.hit path find_or_create_by_hither( path.gsub ANTISLASH, :hither => path, :hits => 0 ).hit end |
Instance Method Details
#hit ⇒ Object
19 20 21 22 23 |
# File 'app/models/divert/redirect.rb', line 19 def hit return nil unless active self.increment! :hits unless self.thither self.thither end |
#name ⇒ Object
Instance Methods
15 16 17 |
# File 'app/models/divert/redirect.rb', line 15 def name "\"#{hither}\" > \"#{thither}\"" end |