DRY database.yml, old saw

See this Pastie, which makes use of File.socket?, Enumerable‘s amazing detect and an ERb variable.

On the #rubyonrails.se IRC channel, simmel made the recipe better by adding the check for File.socket?, instead of File.exists?. (File.socket? will follow symbolic links, as you can see in the pasted code.)

A recipe variation, you might call it.

Published by olleolleolle

Olle is a programmer, enjoying sunny Malmö in Sweden.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.