refactorit-logo

Getting random results from a database table using Active Record is a fairly common action that seems straightforward, but even though there are several ways to do it, they all have their drawbacks and subtleties. For this post I will use Rails 4.2.3 with PostgresSQL 9.3 for all the examples.

Read more...

This post is a follow-up to a talk I gave on the Ruby Zagreb meetup. Themotivation for it was the desire to better understand how Rails works andto learn how to create an application from complete scratch. There aren’tmany use cases for it but it’s worth doing for the sake of becoming abetter Rails developer.

Read more...

I came across a situation that I needed a custom scope in an 5association, something that is unusual. It can help a lot, and here’s how.

Read more...

Here’s a rough equivalent of simple_format helper from Rails. I borrowed basic implementation from Henning Koch.

Read more...