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.
Tags: activerecord, blocks, open source, rails, Posted in English, 8 Comments »
In this post we talk about the motivation of the composed_of removal in the Rails 4.0 and the possible replacements
Tags: activerecord, composed_of, rails 4, Posted in English, Comments Off on About the composed_of removal
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 … »
Tags: cgi, rack, rails, streaming, Posted in English, 14 Comments »
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 … »
Tags: capybara, rails, rspec, Posted in English, 18 Comments »
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 … »
, Posted in English, 7 Comments »
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).
, Posted in Português, Comments Off on Viagem ao Vale do Silício + R$6.000 em prêmios: Hackaton da BlueVia + Evernote + Wayra São Paulo