i18n and l10n on r9r 2.2
Updated at October 10th 2008 to be up to date with Rails 2.2 RC1 Ruby on Rails (r9r ;) ) v2.2 ships with builtin internationalization (i18n). It tries to solve the problem dividing the world: language...
View ArticleTranslating ActiveRecord
Updated October 10th, 2008 to be up to date with Rails 2.2 RC1 release. With Rails 2.2 releasing any day now, I want to show you how to translate ActiveRecord related stuff. It is quite easy, once you...
View ArticleTranslating Columns
I made this into a plugin: translatable_columns. Dmitry asked in the comments of my last post about translating ActiveRecord: Can you write about how to use translated columns of database in rails? For...
View ArticleMy 5 minutes of fame @ RailsConf
Sven Fuchs gave a presentation of Rails i18n today. And I was in the 'thank you' page! :) Nice to see that Sven also thanked himself :)
View ArticleThe Future of I18n in Ruby on Rails @ RailsConf
Sven Fuchs put his presentation of i18n in Ruby on Rails online. A fine presentation! A must read for every Rails developer!
View ArticlePlugin: translatable_columns
It was just three days ago when I discussed how to translate columns. At the moment I was writing it, I was already thinking: "this should be a plugin". So today, I took the liberty and created it....
View ArticleForm Labels in Rails 2.2
Shamelessly copy-pasted from the README file of the new plugin I released today: Since form labels don’t use I18n in Rails 2.2 (I was too late in submitting the patch), we’d have to make due with a...
View Articleacts_as_translatable_model plugin
After a long day in the train today, I extracted the I18n functionality from ActiveRecord so its applicable to any class. This can be especially handy if the source of the data is different, e.g. LDAP....
View ArticleResources
Just a simple little advice for all RESTful programmers out there. It's really simple, and cleans up your code quite a bit. A lot of Rails applications have two roles: an admin and non admin. Your code...
View ArticleLocalizing Dates and Times in Rails 2.2
Here is the next installment of a series of guides I'm writing for internationalizing a Rails 2.2 application. Please read the first part, Translating ActiveRecord, if you haven't already. This time...
View ArticlePluralization Rails 2.2 style
Railscast episode 132 talks about using helpers outside views. All in all a good and useful screencast. I only have one comment: In Rails 2.2 internationalized pluralization goes like this:...
View ArticleAsset paths
Just a quickie. We all know that Rails adds asset ids to images, javascript include tags and stylesheet link tags. This is to help the browser in caching assets properly. The generated code looks...
View ArticleAuthLogic is awesome!
Probably every Rails developer has used restful_authentication. Most of us on practically every application. But restful_authentication generates quite some code and is somewhat an odd plugin. It is a...
View Articleno_value_helper plugin
It took some late night coding, but I finished another plugin. It's a little helper that goes by the name of no_value_helper. To install it, type: ./script/plugin install...
View ArticleChainable.not.gem
Well then: happy holidays! This x-mas, there have been a few nice Ruby presents, like the merging of Rails with Merb and Github has a shiny new feature for creating project sites. I too will present...
View ArticleRSpec, Shoulda, and custom matchers
I have been playing with the matchers that Thoughtbot's Shoulda provides, and they are very cute! For instance, a controller can be easily tested like this: describe ArticlesController do...
View ArticleGem cleanup
I was browsing through the gem documentation today, and I found a command that I didn't know existed. sudo gem cleanup It removes old versions of your installed gems. You can of course specify the gems...
View ArticleNested Forms
The old subject of nested forms comes back again to hunt me. Rails 2.3 has the new and shiny accepts_nested_attributes_for feature. I like it, but there are some things to take into consideration....
View ArticleWriting YAML files
A short one for today: How do I write YAML files? Well, to get the prettiest results, I do something like this: def write(filename, hash) File.open(filename, "w") do |f| f.write(yaml(hash)) end end def...
View ArticleFiltering with named scopes
Suppose you have an index page with people and you want to have a series of neat filters to show a selection of people. For example only the people still alive of only the adults. How would one do...
View Article