Class: Shortenizer::Url
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Shortenizer::Url
- Defined in:
- app/models/shortenizer/url.rb
Instance Method Summary collapse
Instance Method Details
#append_https ⇒ Object
13 14 15 16 17 |
# File 'app/models/shortenizer/url.rb', line 13 def append_https unless self.target =~ /http/i self.target = "http://#{self.target}" end end |
#create_unique_identifier ⇒ Object
7 8 9 10 11 |
# File 'app/models/shortenizer/url.rb', line 7 def create_unique_identifier begin self.shortlink = SecureRandom.hex(8) end while self.class.exists?(:shortlink => shortlink) end |