Update knowledgebase_helper.rb

Reduced assignments and codeduplication.