Module: MongoidShortener::ShortenedUrlsHelper
- Defined in:
- app/helpers/mongoid_shortener/shortened_urls_helper.rb
Instance Method Summary collapse
-
#shortened_url(url) ⇒ Object
generate a url from either a url string, or a shortened url object.
Instance Method Details
#shortened_url(url) ⇒ Object
generate a url from either a url string, or a shortened url object
4 5 6 7 8 |
# File 'app/helpers/mongoid_shortener/shortened_urls_helper.rb', line 4 def shortened_url(url) raise "Only String accepted: #{url}" unless url.class == String short_url = MongoidShortener::ShortenedUrl.generate(url) short_url end |