the activity variable is only used once

use arel_table directly
introduce the viewer_literal variable

call  Arel::SqlLiteral once
remove unneeded variable assignment