Re: Re: Composite Key

Háber János
Fri, 14 Oct 2005 06:12:41 -0000

Bill Lazar írta:

>Háber János <boci@...> writes:
>
>
>
>>I want to create  a multi language table because
>>AR not support composite primary keys...
>>
>>Now I have 2 table words with one column (id)
>>and localized_word with lang_id, word_id ant the localized text.
>>
>>
>
>Probably "Using Gettext To Translate Your Rails Application"
>(http://manuals.rubyonrails.com/read/book/16) is a good place to look for
the
>Rails-normal way of handling this common issue.
>
>
That''s ok, but I want to allow the user modify/add the words. The words
table id is a many table foreign key. Example I have a property table
where the user can add new propertyes , these properties is
multilangual. So that''s the reason why I can''t use gettext.
Ohh and user
can add new languages for their page.

My original thinks I create a composite primary key in the
localized_words table (the key is id and lang, id is auto increment, and
mysql only increment the id if the "selected" lang is exists). Because
AR can''t handle this.

My other (false) think is I create YAML file and I store the keyword -
localized text pairs in this table, but it''s have many problem in
administration (collect all word''s from all table wich not localized,
read/write whole table when I modify etc...)


Cow