« Matt is available for freelance work. Click here to get in touch
So you have a controller that renders PDF’s, and all looks great. You decide to move from HTTP to HTTPS, and everything checks out. You deploy, and suddenly some of your users can’t see the PDF downloads anymore. These users are all running some version of IE - all the way from IE6 up to IE8.
The solution is to set your response headers as follows:
def show
inst = Model.find(params[:id])
response.headers['Content-Transfer-Encoding'] = 'binary'
response.headers['Content-...Truncating HTML is a bit of a pain - in a recent effory to change the layout of my site, I updated the index page to show the last five posts - truncated, of course.
The problem with doing this is that the most common method of truncating a post is to remove all markup and truncate the remaining string. This would be fine, but for a site with a fair amount of colorized code examples (courtesy of Pigments), it can look a little weird.
A better solution would be to truncate based on the nu...