Notes to self

Browsing...

Specifying parameters encoding by action in Rails

At work I needed to accept a Windows-1250 encoding in URL parameters on some actions in one of our Rails API endpoint. The problem is that Rails will scream at you since everything needs to come as UTF-8. Future! Unfortunately some 3rd party Windows software might be still in the past… at that time I was trying to find a way how to write a middleware or patch Rails’ ActionPack to handle this request and what I found was actually a commit that adds this to Rails in master.

Using Ruby gems in Java/Gradle projects with JRuby

Let’s have a quick look on how to reuse our Ruby code and gems in Java leveraging the awesome work of JRuby guys. What we need is Java, Gradle and JRuby installed and we are ready to rock.

Comparing wkhtmltopdf to Prawn for generating PDF in terms of speed, memory and usability

HTML-to-PDF or Prawn? Let’s look how these compare by generating an invoice using PDFKit and InvoicePrinter and examine performance, memory and usability.

Creating staging and other environments in Rails

Ruby on Rails come with three environments by default – development, testing and production. But sooner or later one has a need for staging environment. And don’t get me wrong, you can (or should?) use the production settings there, but if you run it locally or on the same server as production, chances are you need a different database. And while you are at it, it may be handy to allow logging to console or change any other of Rails settings for that matter. In fact you can create as many other environments as you want and since it’s really easy I encourage you to do so.

On managing Ruby versions

This is a little thought on packaged Ruby versions (mostly in Linux-based systems) and why I don’t get many people advising newcomers to start by installing RVM when in reality they just want to program Ruby.

by Josef Strzibny
RSS