Posts Tagged ‘rails’

Quick tip for BackgrounDRb users

January 9, 2009

Earlier today I was configuring BackgrounDRb, and I started to receive this error:

 

 

lucas@work:~$ script/backgroundrb start

        Starting BackgrounDRb …. 

/app/trunk/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_start_stop.rb:42:in `initialize’: No such file or directory – /app/current/tmp/pids/backgroundrb_11006.pid (Errno::ENOENT)

        from /app/trunk/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_start_stop.rb:42:in `open’

        from /app/trunk/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_start_stop.rb:42:in `start’

        from /app/current/script/backgroundrb:35

After a little bit of hacking, I found that it tries to create the pid file, but fails if the directories are not created. Something I don’t understand is why the plugin doesn’t create it, since it is so simple.

So, if this problem ever happens to you, a simple mkdir RAILS_HOME/tmp/pids will save your life.

Dica rápida para quem usa BackgrounDRb

January 9, 2009

Hoje, ao tentar configurar o BackgrounDRb, comecei a tomar esse erro na cara ao tentar subir o servidor de processos:

lucas@work:~$ script/backgroundrb start

        Starting BackgrounDRb …. 

/app/trunk/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_start_stop.rb:42:in `initialize’: No such file or directory – /app/current/tmp/pids/backgroundrb_11006.pid (Errno::ENOENT)

        from /app/trunk/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_start_stop.rb:42:in `open’

        from /app/trunk/vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_start_stop.rb:42:in `start’

        from /app/current/script/backgroundrb:35

Depois de fuçar um pouco, o problema é que se o arquivo não existe, ele tenta criar, mas falha se o diretório pids não existir. O que eu não entendi é porque ele não cria os diretórios que faltam no meio do caminho.
Enfim, se esse problema acontecer com você, um simples mkdir RAILS_HOME/tmp/pids salvará a sua vida.

config.gem, unite!

December 4, 2008

I got tired of letting config.gem kick my behind, so I created a little github project to unite all config.gem in one place, with its options like :lib, :version, making it easy to find.

So, if you want to colaborate just clone the repo and add the config.gem to the gems you use.

http://github.com/lucasuyezu/config.gem–unite-/tree/master
The project is public, I hope google index it soon so people can find the config.gem for their gems in the web quickly.

config.gem, unite!

December 4, 2008

Cansei de apanhar dos config.gem e criei um projetinho no github pra ver se consigo reunir no mesmo lugar os config.gems como devem ser feitos, com as opções, libs e tudo certinho.

Então, quem quiser colaborar, é só clonar o repo e adicionar as gems que vcs utilizam.

http://github.com/lucasuyezu/config.gem–unite-/tree/master

O projeto tá público, espero que o google indexe logo e fique fácil de achar os config.gems na web depois.

“t” method in models and controllers

December 1, 2008

I’m using the i18n api in my pet project and ran into a little problem: I need to use the “t” method in models and controllers, but I couldn’t since “t” is for views.

I thought about including the views modules where needed, which is very ugly. But, Ryan Bates showed me the solution: If you’re outside the view, call “I18n.translate”.

Método “t” nos models e controllers

December 1, 2008

Eu estou usando a api de I18n no meu pet project e me deparei com um problema: eu precisava usar o método “t” nos models e controllers, mas não conseguia, já que “t” é um método para views.

Cheguei a pensar em dar include dos módulos da view onde precisasse, o que é muito porco. Porém, contudo, entretanto, todavia, Ryan Bates mostrou a solução para o meu problema: Se você estiver fora da view e precisar traduzir algo, use “I18n.translate”.