Class: Tanshuku::UrlsController
- Inherits:
-
ActionController::API
- Object
- ActionController::API
- Tanshuku::UrlsController
- Defined in:
- app/controllers/tanshuku/urls_controller.rb
Overview
A Rails controller class for finding a Url record and redirecting to its shortened URL.
Instance Method Summary collapse
-
#show ⇒ void
Finds a Url record from the given
key
parameter and redirects to its shortened URL.
Instance Method Details
#show ⇒ void
This method returns an undefined value.
Finds a Tanshuku::Url record from the given key
parameter and redirects to its shortened URL.
11 12 13 14 |
# File 'app/controllers/tanshuku/urls_controller.rb', line 11 def show url = Url.find_by!(key: params[:key]) redirect_to url.url, status: :moved_permanently, allow_other_host: true end |