Forum: Ruby on Rails Query & compose an array

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
460ead051b49c0b2a8e45e46252d4bda?d=identicon&s=25 Tom Ha (tom)
on 2008-10-30 12:28
Hi there,

What's the correct & most efficient way to compose the following array?

I have:

Existing tables:
================
- users (:id)
- user_languages (:id, :user_id, :language_id)
- languages (:id, :name)

Existing array:
===============
@user_languages

Wanted array: (for a specific user)
=============
"@languages" = Languages.find(:all) - ("Languages" whose ":ids" can be
found as ":language_ids" in the existing array "@user_languages")

Thanks a lot for your help!
Tom
This topic is locked and can not be replied to.