Ewout blogt.

Web development, ruby, and rails

Category: Uncategorized

Translating shared attributes

ActiveRecord can translate the attribute names of a model when the translation is in a predefined path in the locale file. This is more powerful than I18n.translate, since functionality like form helpers can build on top of that. However, there are attribute names that are shared between multiple or all models. Translating them over and [...]

Localized error feedback in rails

Sometimes, something goes wrong in an application. Showing a general error message to the user, even if it is really pretty, is like showing your middle finger. The general goal is to avoid errors, and when they do occur tell the user what is going on and give him a way to resolve the problem. [...]

Running a rails app with MRI and jRuby

jRuby has become a stable alternative for running rails applications. It gives the ruby programmer access to the vast amount of java libraries that are available. One of our applications uses jRuby for its import tasks, so it can use the power of JDBC to connect to a multitude of data sources, in our case [...]

Foreign key migrations: hands on

In the previous article, I explained the benefits of backing a rails application with database constraints. Referential integrity was mentioned, along with some general gotchas. In this post, we’ll apply referential integrity to an existing rails application, using the foreign key migrations plugin. The sample project is on github. The reason we use that plugin [...]

Rails models with teeth and database constraints

One of the things I do not like about ruby on rails is the arrogance it came with. Of course, creating a blog application from scratch in 15 minutes was cool at the time, but that does not mean the author  of the framework holds all truth. As a computer scientist I appreciate the ruby [...]

Accumulated wealth

Every generation can build upon the wealth accumulated by previous generations. Using the tools of our forefathers, we create new things and invent the tools for the next generation. While “tool” refers to a material entity, it is  the knowledge to manipulate our environment that made us humans who we are. Knowledge has always been [...]