From ba0811b35d41a18a01977ba53147da522541b151 Mon Sep 17 00:00:00 2001 From: Robin Houston Date: Wed, 6 Jun 2012 15:37:15 +0100 Subject: Fix indexing of info_request_events Even external requests need to be indexed, for which we need a slug representing the user. --- app/models/info_request.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'app/models/info_request.rb') diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 8d9d92b0d..99cbe476a 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -128,6 +128,19 @@ class InfoRequest < ActiveRecord::Base def user_name is_external? ? external_user_name : user.name end + + def user_name_slug + if is_external? + if external_user_name.nil? + fake_slug = "anonymous" + else + fake_slug = external_user_name.parameterize + end + public_body.url_name + "_"+fake_slug + else + user.url_name + end + end @@custom_states_loaded = false begin -- cgit v1.2.3