Globalize2 i Betternestedset

Co chcę osiągnąć: zbudować wielojęzyczną strukturę drzewiastą kategorii (np. produktów), wprowadzanie/aktualizacja nazw kategorii ma się odbywać na jednym formularzu dla wszystkich języków jednocześnie

Oprogramowanie:

  • Ruby 1.8.5 - taki mam w RHEL5
  • RoR 2.3.8
  • Globalize2 0.2.1
  • betternestedset

Model Category:

[code=ruby]class Category < ActiveRecord::Base
translates :name

accepts_nested_attributes_for :translations

acts_as_nested_set

end[/code]
Problem: nie działa aktualizacja pola name
Przykładowa sesja z konsoli (dla języka polskiego name powinno się zmienić z “dziecko4” na “dz4”):

[code]Loading development environment (Rails 2.3.8)

a={“translations_attributes”=>[{“name”=>“dz4”, “id”=>“6”, “locale”=>“pl”},{“name”=>“ch4”, “id”=>“12”, “locale”=>“en”}]}
=> {“translations_attributes”=>[{“name”=>“dz4”, “id”=>“6”, “locale”=>“pl”}, {“name”=>“ch4”, “id”=>“12”, “locale”=>“en”}]}

c=Category.find(6)
=> #<Category id: 6, parent_id: 2, lft: 10, rgt: 11, created_at: “2010-06-14 12:29:00”, updated_at: “2010-06-14 12:29:00”>

c.translations
=> [#<Category::Translation id: 6, category_id: 6, locale: “pl”, name: “dziecko4”, created_at: “2010-06-14 12:29:00”, updated_at: “2010-06-14 21:21:26”>,
#<Category::Translation id: 12, category_id: 6, locale: “en”, name: “ch4”, created_at: “2010-06-14 19:26:37”, updated_at: “2010-06-14 19:26:40”>]

c.update_attributes a
=> true

c.translations
=> [#<Category::Translation id: 6, category_id: 6, locale: “pl”, name: “dz4”, created_at: “2010-06-14 12:29:00”, updated_at: “2010-06-14 21:21:26”>,
#<Category::Translation id: 12, category_id: 6, locale: “en”, name: “ch4”, created_at: “2010-06-14 19:26:37”, updated_at: “2010-06-14 19:26:40”>]

c.save
=> true

c.translations
=> [#<Category::Translation id: 6, category_id: 6, locale: “pl”, name: “dz4”, created_at: “2010-06-14 12:29:00”, updated_at: “2010-06-14 21:21:26”>,
#<Category::Translation id: 12, category_id: 6, locale: “en”, name: “ch4”, created_at: “2010-06-14 19:26:37”, updated_at: “2010-06-14 19:26:40”>]

c.reload
=> #<Category id: 6, parent_id: 2, lft: 10, rgt: 11, created_at: “2010-06-14 12:29:00”, updated_at: “2010-06-14 12:29:00”>

c.translations
=> [#<Category::Translation id: 6, category_id: 6, locale: “pl”, name: “dziecko4”, created_at: “2010-06-14 12:29:00”, updated_at: “2010-06-14 21:21:26”>,
#<Category::Translation id: 12, category_id: 6, locale: “en”, name: “ch4”, created_at: “2010-06-14 19:26:37”, updated_at: “2010-06-14 19:26:40”>]

c=Category.find(6)
=> #<Category id: 6, parent_id: 2, lft: 10, rgt: 11, created_at: “2010-06-14 12:29:00”, updated_at: “2010-06-14 12:29:00”>

c.translations
=> [#<Category::Translation id: 6, category_id: 6, locale: “pl”, name: “dziecko4”, created_at: “2010-06-14 12:29:00”, updated_at: “2010-06-14 21:21:26”>,
#<Category::Translation id: 12, category_id: 6, locale: “en”, name: “ch4”, created_at: “2010-06-14 19:26:37”, updated_at: “2010-06-14 19:26:40”>][/code]
I jeszcze informacja z logów:

SQL (0.1ms) SET NAMES 'utf8' SQL (0.1ms) SET SQL_AUTO_IS_NULL=0 Category Columns (0.7ms) SHOW FIELDS FROM `categories` Category Load (9.0ms) SELECT * FROM `categories` WHERE (`categories`.`id` = 6) Category::Translation Load (0.5ms) SELECT * FROM `category_translations` WHERE (`category_translations`.category_id = 6) Category::Translation Columns (0.7ms) SHOW FIELDS FROM `category_translations` SQL (0.1ms) BEGIN Category Update (0.3ms) UPDATE categories SET `created_at` = '2010-06-14 12:29:00', `parent_id` = 2, `updated_at` = '2010-06-14 12:29:00' WHERE id = 6 SQL (0.0ms) COMMIT Category Load (0.4ms) SELECT * FROM `categories` WHERE (`categories`.`id` = 6) Category::Translation Load (0.4ms) SELECT * FROM `category_translations` WHERE (`category_translations`.category_id = 6) SQL (0.1ms) BEGIN Category Update (0.3ms) UPDATE categories SET `created_at` = '2010-06-14 12:29:00', `parent_id` = 2, `updated_at` = '2010-06-14 12:29:00' WHERE id = 6 SQL (0.0ms) COMMIT Category Load (0.3ms) SELECT * FROM `categories` WHERE (`categories`.`id` = 6) Category::Translation Load (0.4ms) SELECT * FROM `category_translations` WHERE (`category_translations`.category_id = 6) SQL (0.1ms) BEGIN Category Update (0.3ms) UPDATE categories SET `created_at` = '2010-06-14 12:29:00', `parent_id` = 2, `updated_at` = '2010-06-14 12:29:00' WHERE id = 6 SQL (0.0ms) COMMIT SQL (0.3ms) BEGIN Category Update (0.3ms) UPDATE categories SET `created_at` = '2010-06-14 12:29:00', `parent_id` = 2, `updated_at` = '2010-06-14 12:29:00' WHERE id = 6 SQL (0.0ms) COMMIT Category Load (0.4ms) SELECT * FROM `categories` WHERE (`categories`.`id` = 6) Category::Translation Load (0.5ms) SELECT * FROM `category_translations` WHERE (`category_translations`.category_id = 6) SQL (0.1ms) SET NAMES 'utf8' SQL (0.1ms) SET SQL_AUTO_IS_NULL=0 Category Columns (0.8ms) SHOW FIELDS FROM `categories` Category Load (20.4ms) SELECT * FROM `categories` WHERE (`categories`.`id` = 6) Category::Translation Load (0.4ms) SELECT * FROM `category_translations` WHERE (`category_translations`.category_id = 6) Category::Translation Columns (0.7ms) SHOW FIELDS FROM `category_translations` SQL (0.1ms) BEGIN Category Update (0.3ms) UPDATE categories SET `created_at` = '2010-06-14 12:29:00', `parent_id` = 2, `updated_at` = '2010-06-14 12:29:00' WHERE id = 6 SQL (3.3ms) COMMIT SQL (0.1ms) BEGIN Category Update (0.3ms) UPDATE categories SET `created_at` = '2010-06-14 12:29:00', `parent_id` = 2, `updated_at` = '2010-06-14 12:29:00' WHERE id = 6 SQL (0.1ms) COMMIT Category Load (0.4ms) SELECT * FROM `categories` WHERE (`categories`.`id` = 6) Category::Translation Load (0.6ms) SELECT * FROM `category_translations` WHERE (`category_translations`.category_id = 6) Category Load (0.4ms) SELECT * FROM `categories` WHERE (`categories`.`id` = 6) Category::Translation Load (0.4ms) SELECT * FROM `category_translations` WHERE (`category_translations`.category_id = 6)
Zarządzanie strukturą (betternestedset) działa prawidłowo, Globalize2 bez “acts_as_nested_set” również działa prawidłowo.

Gdzie szukać błędu? Czy to ja robię coś nie tak czy może te pluginy nie będą tak ze sobą pracować i trzeba jakieś obejście robić?