When you scale a Rails website the database layer tends to become the bottleneck sooner or later as it’s more difficult to scale horizontally with hardware than the Ruby/web server layer. At MyNewsdesk we have started looking at database caching in the model layer to offload our PostgreSQL database. Unfortunately caching does no longer seem [...]
I think a lot of Rails developers have been using the db:migrate Rake task to setup new development databases. The problem with this is that over time migrations tend to grow out of sync with the code, especially if you use model classes in your migrations (which in some cases can be very convenient and [...]
March 17, 2009 – 10:57 am
We just pushed the latest addition to the Translate plugin which adds a new rake task: “rake translate:google FROM=sv TO=en”. This will translate all keys in sv.yaml using Google Translate into english and store them in en.yaml.
This is a very convinient way of testing your application in a translated state, and look for strings [...]
February 6, 2009 – 12:09 pm
We’ve added two Rake tasks to the Translate plugin. The lost_in_translation rake task helps find I18n keys in lookups in your code that are missing from your default locale YAML file (i.e. config/locales/sv.yml in our case). The merge_keys Rake task is used in conjunction with Sven Fuchs’s Rails I18n Textmate bundle to move extracted keys [...]
January 23, 2009 – 5:18 pm
For those of you looking for Swedish pluralization for Rails, I just refactored this module of ours into a plugin. You can find it on GitHub: http://github.com/newsdesk/swedish_pluralize/tree/master
It’s extracted from the old swe_rails plugin by Ola Bini, which did a bit more than just pluralize in Swedish. So if pluralize is all you want to do, [...]
November 28, 2008 – 3:00 pm
This one you will find all over the Rails code. The “returning” trick is a really neat way to refactor ugly patterns, such as this one:
object = []
object << “foo” if bar?
object
Into this:
returning [] do |object|
object << “foo” if bar?
end
So what returning does is, it creates an object using the first parameter (a [...]
November 28, 2008 – 2:38 pm
Welcome to the blog! I thought it would be appropriate to shortly present Newsdesk in a post before anything else.
If you don’t know about us (and chances are small you do, unless you’re living in Sweden), we are a Swedish equivalent to PRWeb, or PR Newswire in some ways.
We are an online visibility company. Corporations [...]
November 25, 2008 – 3:05 pm
A week ago i got an interesting ticket - update the Newsdesk statistics charts for printing and sending via email. Although people here are quite satisfied whith the look and feel of our current solutions Fusion Charts, we feel that not being able to print the whole statistics page in one job is a huge [...]