philomena/lib/philomena_web/controllers/advert_controller.ex
2019-11-29 01:26:05 -05:00

17 lines
No EOL
321 B
Elixir

defmodule PhilomenaWeb.AdvertController do
use PhilomenaWeb, :controller
alias Philomena.Adverts
alias Philomena.Adverts.Advert
plug :load_resource, model: Advert
def show(conn, _params) do
advert = conn.assigns.advert
Adverts.click(advert)
conn
|> redirect(external: advert.link)
end
end