# In Some Controller
def print
grid_size = 18
@word_search_puzzle = WordSearchPuzzle.find(params[:word_search_puzzle_id])
SearchWordDocument.generate_pdf(@word_search_puzzle.words, grid_size, params[:num_puzzles])
end
# In application.rb
config.autoload_paths += %W(#{config.root}/lib)
# In lib/search_word_document.rb
class SearchWordDocument < Prawn::Document
. . .
. . .
. . .
end