DataMapper extras

Although I no longer use DataMapper I thought I would share some of my code for it in case it can help anyone who has experienced the same problems. Today I created a GitHub project which includes two helpers: 1. Adding an all_error_messages() method to objects. By default DM’s validation only shows you errors about the…

Read More

A year of Ruby

It’s about a year today that I took on the task of maintaining and extending a REST API with just over a month of Ruby experience under my belt. Despite being so new to the language I felt confident that I could take on the project as I had already managed to build a portal for…

Read More

2014

So, we have begun a new year; already two years on from the widely (or should that be wildly?) predicted end-of-the-world. This year I have many goals, grouped into different categories such as mind, body, learning. It’s going to be tough to try and achieve all of them but I’m determined to make 2014 a…

Read More

Why we abandoned Ruby DataMapper

At my work (Give.it) we had a REST API that used Ruby’s DataMapper ORM for database operations. Initially this seemed to work okay but as the API became more complex we stumbled into a growing number of pitfalls. While a lot of the basic functionality was covered by the existing code I found that it…

Read More

Ubuntu Edge

So it turns out that Ubuntu didn’t get enough crowd sourcing for the Edge project. One has to wonder what they were thinking in having a limit of only 30 days to collect funds? When you look at the most successful crowdsourced project to date, Roberts Space Industries it took them four months to reach…

Read More

PHP and extensions

This week I’ve had to do some PHP work, something that is becoming less and less common as I use other languages. Part of my work required setting up some extensions for PHP. PECL is a nightmare, requiring so many development libraries to be installed (and in some cases compiled from scratch) to get the…

Read More

PRISM

PRISM, the surveillance program has been in the news a lot recently. What the acronym stands for seems to be something of a mystery, in fact Wikipedia simply calls it a “government code name”. I think I know what it means: Privacy Really IS Mythical…

Read More

Avoiding hidden form fields

Hidden fields in a form can be useful, but they can also pose a huge security risk. Take an example of a web page which allows a user to edit a customer’s details.

Using a browser add-on such as Firebug it’s very easy for a user to change the value of that customer_id field…

Read More

Asserting that an array contains another array in PHPUnit

I needed to test whether one array contained a subset of another array in PHPUnit. There’s no built-in function for that so if you have a similar need feel free to use the code below:

Read More

Ruby DataMapper aliased associations

In Ruby’s DataMapper ORM you can easily associate one type of object with another, e.g. an Image can have many Tags. For the most part DM takes care of the issue of pluralization, ie. if your tag object is Tag then the associated tag collection is accessed as image.tags However, what if you want to…

Read More