Contribuindo: plugin reserved_attributes para Rails

(nota: esta é a “tradução” do post anterior)

Esta é minha primeira contribuição para a comunidade Rails: o plugin reserved_attributes.

O plugin é muito simples, apenas adicionando uma task rake ao seu projeto. A task varre todos os seus modelos procurando por attributos que tenham nomes que são palavras reservadas do Ruby/Rails e te avisando disso.

Há algum tempo atrás desperdicei 8 horas de trabalho porque meus testes unitários davam um erro muito estranho (e um trace gigantesco). No fim das contas, eu tinha um atributo chamado “notify”, que é o nome de um método interno, então eu estava sobrescrevendo esse método e bagunçando tudo. Vi muita gente com esse problema, então aqui está uma pequena ajuda. Dê uma olhada na página principal do repositório para ver o README com instruções.

O plugin está hospedado no github e você é livre para fazer um fork e melhorá-lo.

Contributing: reserved_attributes Rails plugin

Here’s my first contribution to the Rails community: the reserved_attributes plugin.

The plugin is very simple, just adding a rake task to your project. The task scans all your models checking its attributes (columns) and warning you if any of them have a name that are a Ruby/Rails reserved word.

Some time ago I spent about 8 hours of work because my unit tests was breaking with a very strange error (and a gigantic trace). It turns out that I was using an attribute called “notify” and there’s already an internal method with that name, so I was overriding it and breaking everything. I’ve seen many people with the same problem, so here’s a little help. Take a look at the repository main page to see the README file with instructions.

The plugin is hosted at github and you’re free to fork and improve it.