Articles tagged with  activerecord

Invalid Object Is An Anti-Pattern

December 28, 2015 by Piotr Solnica

The idea of an object that validates its own state has been made very popular by Rails’ ActiveRecord. We can see this pattern in many places, not only in ORM libraries but in many other gems whenever some sort of validation is needed.

Have you ever...

Introducing dry-validation

December 07, 2015 by Piotr Solnica

We started experimenting with a new validation library under dry-rb organization a couple of months ago, and last month I released the first version of dry-validation. Since then I worked hard on improving it and adding support for i18n.

Today, I...

TDD and ActiveRecord in Rails

January 06, 2014 by Piotr Solnica

I don’t have exact numbers but I believe TDD isn’t really popular amongst rails developers. This shouldn’t be a surprise given that the two of the most complex elements in the rails stack, models and controllers, are very convoluted concepts and are...

The State of Ruby ORM

November 29, 2011 by Piotr Solnica

UPDATE: DataMapper 2 was renamed to Ruby Object Mapper (ROM). For more info check out

We have a lot of different Object-Relational Mapper implementations in Ruby (and a ton and a half of Mongo mappers ;)) and it’s probably a good thing...

Making ActiveRecord Models Thin

August 01, 2011 by Piotr Solnica

“Skinny Controller, Fat Model” is a well known best practice in Ruby community. Everybody seems to agree with it and follows it. It’s pretty clear what a skinny controller is. The question is what is a fat model and what should we do if it gets too...