The World Needs Another Post About Dependency Injection in Ruby

I was wondering what do we, rubyists, think about dependency injection these days as I remember some discussions about it which were mostly lots of post-java-trauma type of criticism. I had this blog post in the back of my head for a long time but knowing that this subject was sort of…explored already, I decided to see what google has to say before writing it. So I typed “ruby dependency injection” and got this:...

December 17, 2013 · 4 min · Peter Solnica

New Virtus Release With Truly Awesome Features

Just a quick announcement that I just pushed a new version of Virtus with support for long awaited features: EmbeddedValue, member type coercions for array/set attributes and ValueObject. Current version is 0.2.0, please give it a try and tell me what you think. Here’s a quick sneak-preview of what you can do with Virtus: class GeoLocation include Virtus::ValueObject attribute :lat, Float attribute :lng, Float end class City include Virtus attribute :name, String attribute :location, GeoLocation attribute :districts, Array[Symbol] end class User include Virtus attribute :name, String attribute :age, Integer attribute :city, City end user = User....

February 8, 2012 · 1 min · Peter Solnica

Ruby DataMapper Status

UPDATE: DataMapper 2 was renamed to Ruby Object Mapper (ROM). For more info check out rom-rb.org In my recent post I gave you a brief overview of what I think about the state of Ruby ORMs. Since I’m involved in the development of DataMapper project I want to write a little more lines of text to give you a good overview of the current state of DataMapper project and how the future version 2....

January 10, 2012 · 8 min · Peter Solnica

The State of Ruby ORM

UPDATE: DataMapper 2 was renamed to Ruby Object Mapper (ROM). For more info check out rom-rb.org 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. It seems like the only ORM that really matters right now is ActiveRecord although in “the background” we still have DataMapper and Sequel with growing communities. So I’m wondering…what’s the state of these ORMs?...

November 29, 2011 · 7 min · Peter Solnica

Making ActiveRecord Models Thin

“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 fat? Even better, what should we do to avoid too fat model? I think many people still confuse Domain Model with ActiveRecord. It’s something more and in this post I will try to explain my new approach to writing Ruby on Rails applications....

August 1, 2011 · 8 min · Peter Solnica