MailingList


problem with pattern used to build where clause in db_translate.rb

View: New views
1 Messages — Rating Filter:   Alert me  

problem with pattern used to build where clause in db_translate.rb

by Andrew Reynolds-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Here is the background to the error I'm having.

Base language is en-CA
current locale is set to fr-CA
In my app I call

page.find_by_name('french name')

and get a mysql syntax error Globalize is setting the where clause to

  WHERE (`pages`. COALESCE(t_name.text, pages.name)  = 'french name')

notice the `pages`. that shouldn't be there

The Where clause is built on line 851 of db_translate.rb (trunk)

where_clause.gsub!(/((((#{table_name}\.)|\W)#{facet})|^#{facet})\W/, "  
COALESCE(#{facet_table_alias}.text, #{table_name}.#{facet}) ")

One solution would be to rewrite the pattern but I don't want to  
change the plugin code since that may stop me from being able to  
update in the future. Has any one else run into a similar problem or  
have a solution to finding records based on translated fields that  
doesn't require modification to the plugin?

Thanks
Andrew