philomena/lib/philomena_web/controllers/advert_controller.ex

17 lines
323 B
Elixir
Raw Permalink Normal View History

2019-11-29 07:26:05 +01:00
defmodule PhilomenaWeb.AdvertController do
use PhilomenaWeb, :controller
alias Philomena.Adverts.Advert
alias Philomena.Adverts
2019-11-29 07:26:05 +01:00
plug :load_resource, model: Advert
def show(conn, _params) do
advert = conn.assigns.advert
Adverts.record_click(advert)
2019-11-29 07:26:05 +01:00
2020-05-27 23:14:22 +02:00
redirect(conn, external: advert.link)
2019-11-29 07:26:05 +01:00
end
2020-01-11 05:20:19 +01:00
end