Active Record loves blocks

When creating an Active Record object, either by using `new` or `create`/`create!`, or even through a `belongs_to` or `has_many` association, you can give a block straight to the method call instead of relying on `tap`. It is possible to avoid doing manual work, sometimes simple stuff such as using `tap` with methods like these, or sometimes more complicated things, by getting to know what a framework like Rails can give us for free.

About the composed_of removal

In this post we talk about the motivation of the composed_of removal in the Rails 4.0 and the possible replacements

Why your web framework should not adopt Rack API

Or, even better, why your web framework should not adopt a CGI-based API. For the past few years I have been studying and observing the development of different emerging languages closely with a special focus on web frameworks/servers. Unfortunately, most of the new web frameworks are following the Rack/WSGI specification which may be a mistake … »

Improving the integration between Capybara and RSpec

When David Chelimsky was visiting São Paulo in last April, we invited him to go out for some coffee, beers and brazilian appetizers. We had a great time and we talked about different topics like OO, programming languages, authoring books and, as expected, about testing. One of the topics in our testing discussion was the … »

Active Record `attribute?` method

Last week, while developing a feature I had some code like this in a view: link_to_unless @post.url.blank?, “Link to post”, @post.url Where url is an attribute of type String. As people usually don’t like negative conditionals, we can easily rewrite this code as: link_to_if @post.url.present?, “Link to post”, @post.url However, we can clean our code … »

Viagem ao Vale do Silício + R$6.000 em prêmios: Hackaton da BlueVia + Evernote + Wayra São Paulo

A BlueVia, Evernote e a Wayra estão organizando um Hackaton durante os dias 26 e 27 de maio, para criar e-inclusão para gerar novas idéias e serviços, especialmente aqueles focados em usuários de “feature phones” (ou seja, para aqueles que ainda não tem um smartphone).