Ruby on Rails Monday, April 26, 2010

@Colin Ahh yes of course, well my example was just to demonstrate the usage of i18n.

Roles should of course me a separate table, but then again, the separate table will have a role column right :).

@Yiannis Using multiple tables for the purpose of internationalization to me seems like such an overkill, how do you map a single model to different table based on the locale ?

On Mon, Apr 26, 2010 at 21:53, Colin Law <clanlaw@googlemail.com> wrote:
On 26 April 2010 13:55, Dhruva Sagar <dhruva.sagar@gmail.com> wrote:
>...
>
> eg.) Lets say I have a User model and each user has a 'role' as a column. So
> if I want to internationalize the value of the 'Role', you propose that it
> should be done using the database ?
> I imagine so then for internationalizing to 5 different languages, I would
> then have to create 5 records for this very user with different 'Role'
> values for each language.

I suggest that the role as a string 'Administrator' or whatever should
not be a column in the users table.  The roles should be in a separate
table, with user belongs_to role.  I think this will make your life
much easier.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.




--

Thanks & Regards,
Dhruva Sagar.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment