Sha256: 681dcda5942ee8409b4527ce06cf55748d51b42971f104e546634c485b8c526e
Contents?: true
Size: 583 Bytes
Versions: 8
Compression:
Stored size: 583 Bytes
Contents
require_dependency "letter_opener_web/application_controller" module LetterOpenerWeb class LettersController < ApplicationController def index @letters = Letter.search end def show letter = Letter.find(params[:id]) text = letter.send("#{params[:style]}_text"). gsub(/"plain\.html"/, "\"#{letter_path(id: letter.id, style: 'plain')}\""). gsub(/"rich\.html"/, "\"#{letter_path(id: letter.id, style: 'rich')}\"") render text: text end def clear Letter.destroy_all redirect_to letters_path end end end
Version data entries
8 entries across 8 versions & 1 rubygems