svenfuchs/globalize3 — Issue #100: destroy using dynamic finders does not destroy all translations
Author: shioyama
Created: 2012-02-05 06:48:56+00:00
State: open

I thought this was a problem specific to my own code, but I just created a basic skeleton app and tried the same thing, and found the same issue, so I'm starting to think it's a problem with globalize3 itself.

If I create a model (`Post`) with a translated attribute (`title`) and set the title in two languages:

Globalize.locale = :en
post = Post.create(:title => "a title")
Globalize.locale = :ja
post.update_attributes(:title => "タイトル")

then get the post using a dynamic finder:

Globalize.locale = :en
post = Post.find_by_title("a title")

and then destroy it, but it doesn't destroy the translation in the other language:

post.destroy
Post::Translation.all # => [#]

However, if instead of the dynamic finder you use a normal Post.find() on the id, then it works and properly destroys both translations.

Am I missing something here? Any help would be much appreciated.