I'm not sure if this is the right way to go about this, but I have two 
tables Users and Teams, with the following join table:

    class CreateTeamsUsers < Sequel::Migration
      def up
        create_table :teams_users do
          foreign_key :team_id, :teams
          foreign_key :user_id, :users
          
          column :role, String
    
          primary_key [:team_id, :user_id]
        end
      end
    end

    class Team < Sequel::Model
      many_to_many :users
    end

    class User < Sequel::Model
      many_to_many :teams
    end

The :role column specifies the role of the user as a member of the team, 
i.e. it could be "Owner", "Admin", "Guest", etc. 

I can't see how I can get access to the :role column for querying. I'd like 
to be able to select all team administrators, for example:

    Team[1].admins
    => [#<User @values={:id=>1}>, ...]

Any help or advice gratefully received! ;-)

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/c208a266-555d-4396-871f-f532faef2bc2%40googlegroups.com.

Reply via email to