> This is completely fishy. Rails is not supposed to translate strings > behind your back. Are you any extensions (gems, plugins) that may try to > be helpful in the wrong way? Well, I used globalize2 when I used Rails 2.3.8 and everything worked perfectly fine but no new gems or anything eversince. Must be globalize3 or something... > > Out of the box, #find_by_name behaves exactly the same as > #find_by_foobar, which is to say, it executes an SQL statement > containing a comparison of column "name" with the string you provide. It > looks like a call to I18n.translate has been slipped in somewhere. > > Do you get the same result for Page.where(:name => 'Welcome').first? where doesn't work because it's in a different table: Page.where(:name => 'Willkommen') ActiveRecord::StatementInvalid: Mysql::BadFieldError: Unknown column 'pages.name' in 'where clause': SELECT `pages`.* FROM `pages` WHERE (`pages`.`name` = 'Willkommen') > > In order to find the real cause, your best bet is to use the debugger > and step into the misbehaving statement. I guess I have no other choice...
Just to make my problem a bit more clear: irb(main):030:0> I18n.locale = :de => :de irb(main):031:0> Page.find_by_name("Welcome") => [] irb(main):032:0> Page.find_by_name("Willkommen") => [#<Page id: 93372675, text: "blah blah", created_at: "2010-09-12 12:55:41", updated_at: "2010-09-12 12:55:41">] irb(main):033:0> I18n.locale = :en => :en irb(main):034:0> Page.find_by_name("Welcome") => [#<Page id: 93372675, text: "blah blah", created_at: "2010-09-12 12:55:41", updated_at: "2010-09-12 12:55:41">] irb(main):035:0> Page.find_by_name("Willkommen") => [] Before I upgraded to Rails 3 all four queries returned the same result. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.