On 12 jan, 19:45, "Iain Hecker" <[email protected]> wrote:
> Hi Sébastien,
Hi Iain, so glad to ear from you.
> Stuff like find_by_title might be done, but not so soon, since it's
> rather complex to implement it properly.
I've actually started to work on it, as actual model specific pacth
this works for me:
class << self
def find_by_title(title)
self.first(:joins => :globalize_translations,
:conditions => ["page_translations.title = :title AND
page_translations.locale IN (:locales)",
{:title => title, :locales =>
I18n.fallbacks[I18n.locale].map{|tag| tag.to_s}}])
end
end
> The conditions like you describe are probably never going to happen.
I've actually came to this point porting an existing application
> To change this, we would need to monkeypatch Rails to not query it,
> although it should. No sane programmer would attempt such a thing.
> It's unmaintainable.
Don't you think intercepting the SQL generation to replace translated
column names (eg. title) by appropriate value (eg. page.title) would
be fine and maintainable ?
As usage I would fine awesome to keep using the translatable
attributes as not translated.
Makes sense ?
Warm regards,
--
Sebastien Grosjean - ZenCocoon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"rails-i18n" 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/rails-i18n?hl=en
-~----------~----~----~----~------~----~------~--~---