Posted on May 20, 2008 at 3:44 pm

Globalize versus PDF-Writer, round one!

If you ever needed to generate PDFs dinamically on a Rails app, one of the easiest (and possibly more elegant) PDF generation Rails options you’ll find is using the PDF-Writer combo. The good thing with that combo is that you can go and define your PDFs as views using a different extension (.rpdf is suggested). [...]

Posted on May 5, 2008 at 11:41 am

Rails 1-2-3 (on Leopard)

Getting Rails (and related stuff - RMagick, MySQL, etc) to run on OS X is an easy task, although not as straightforward as it seems at first. Here’s a small collection of things that you have to do to have it done in just a few minutes:
- Install MacPorts, an apt-get like package manager for [...]

Posted on March 28, 2008 at 3:59 pm

Geolocate yourself with Graticule

Graticule is an interesting piece of Gem that puts together a bunch of geocoding services available over the Internets in one concise and easy to use package. Using it is a snap:

require ‘graticule’

coder = Graticule.service(:yahoo).new “api_key”
locale = coder.locate “New York, NY 10003″
=> #<Graticule::Location:0×2c1dc14 @latitude=40.73236, @precision=:city, @locality=”Manhattan”, @country=”US”, @postal_code=”10003″, @longitude=-73.989089, @warning=”The exact location could not be [...]

Posted on March 17, 2008 at 5:53 pm

Ruby on Rails and the newbie phenomenon

It’s hard to find good C++ developers. Being such a relatively hard language to start with, it’s even hard to find lousy C++ developers, sometimes. It’s interesting to notice that such curve clearly changes as programming languages get ‘easier’ to grasp: cleaner syntaxes, garbage collection facilities, less build/link/compile/deploy steps, more openly available libraries - the [...]

Posted on September 17, 2007 at 5:00 pm

Relative Roots in Rails

One thing I noticed on each and every single PHP application out there is that they all resort in some kind of global variable defined in an include file to determine what is the application’s root. Something like:

$root = ‘http://www.bla.com/my_site’

and then all the links are generated like:

$root.’/something’

That makes all the urls absolute, and pretty much [...]

Posted on August 26, 2007 at 10:21 pm

Singletons no Rails

Se você já precisou alguma vez utilizar objetos singleton em seu projeto Rails, você deve ter percebido que os Singletons não são exatamente… Singletons. Suponha que você crie a seguinte classe em seu diretório /app/model:

class MySillySingleton
include Singleton
end

SEMPRE que um novo request for feito, uma nova instância da classe será retornada:

puts MySillySingleton.instance
=> #

E no [...]

Posted on July 19, 2007 at 5:44 am

Making Rails go Vrooom

An awesome article pointing out a big bunch of performance improvement tips for Rails applications that brought down rendering time up to 700% on Charlie’s application. Quite an improvement indeed! The tip on not using link_to and url_for is quite shocking for me since I use them a lot (like almost everybody, I guess). Maybe [...]

Posted on July 11, 2007 at 1:43 pm

Rigg

O Projeto Rigg acaba de ser disponibilizado em código aberto - e precisa de desenvolvedores. Rigg é uma aplicação Rails que permite a construção rápida de sites de notícias colaborativas como Digg.com, DZone.com e Reddit.com.
A versão inicial ainda tem um bom número de pontas soltas, mas uma versão alfa deverá ser lançada dentro de alguns [...]

Posted on July 11, 2007 at 9:43 am

Rigg

The Rigg Project is now online, open-sourced and calling for developers. Rigg is a Rails application that allows quick implementation of collaborative news sites like Digg.com, DZone.com or Reddit.com.
The initial release is still a work in progress - an alpha release is expected anytime soon, but the source code is already accessible as we speak.
Happy [...]

Posted on July 7, 2007 at 2:30 pm

User expected, got User?

Sem dúvida uma das mensagens mais irritantes que já tive o desprazer de encontrar nas andanças pelo Rails, a infame “User expected, got User” tende a aparecer, quando se utilizam plugins como o acts_as_commentable ou o acts_as_taggable, que definem Models dentro do diretório vendor/plugins.
A solução, como apontado pelo blog localhost:3000 blog (belo nome para um [...]