Class: LinkRouterController

Inherits:
UmlautController show all
Defined in:
app/controllers/link_router_controller.rb

Instance Method Summary collapse

Methods included from Umlaut::ControllerBehavior

#default_url_options, #set_locale

Methods included from UmlautConfigurable

set_default_configuration!

Instance Method Details

#indexObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/link_router_controller.rb', line 10

def index
  # Capture mysterious exception for better error reporting.
  begin
    svc_response = ServiceResponse.find(params[:id])
  rescue ActiveRecord::RecordNotFound => exception
    # Usually this happens when it's a spider trying an old link. "go" links
    # don't stay good forever! Bad spider, ignoring our robots.txt.
    log_error_with_context(exception, :warn)
    raise exception# will be caught by top level rescue_from
  end
  @collection = self.create_collection
  clickthrough = Clickthrough.new
  clickthrough.request_id = svc_response.request_id
  clickthrough.service_response_id = svc_response.id
  clickthrough.save
  redirect_to calculate_url_for_response(svc_response)
end