On Dec 8, 2009, at 4:40 PM, isaac wrote: > This may not be a Hobo thing but I though I'll ask anyway > > when I create new user with hebrew letters in the name, and then go to > this user page, the URL show blank space where the name should be > eg. appname.com/users/1- > instead of appname.com/users/1-איציק > is this a Hobo thing? Rails? > does anybody know how to solve it? > > > (beside this, it works perfectly even without the hebrew letters in > the URL)
It works because the extra stuff after dash isn't actually used for anything; the parser basically calls to_i on the string, which converts "1-whatever" to just 1. In your case, the (UTF8, I presume?) characters are being swallowed by model.rb's definition of to_param (in the hobo plugin). Non-USASCII characters are not allowed in URLs (see RFC 1738 - http://www.faqs.org/rfcs/rfc1738.html) , so the alternatives are: - encode the characters; that will give you a URL like users/1- %e0%45%e0%25 (the characters are made up; the % encoding is not) - or, more likely, you may want to turn off / alter the behavior entirely for user models; you can do this by redefining to_param: class User < ActiveRecord::Base ..etc... def to_param "#{id}-#{something relevant}" end end "something relevant" here might be a transliteration of the original characters to ASCII (no idea how practical that is for Hebrew) or even omitting the second part entirely. BTW, have you encountered any other issues (text direction, for instance) when using Hobo? I18n is a fairly late arrival at the Hobo party. Hope this helps! --Matt Jones -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
