views:

25

answers:

1

I have a many-to-many association between a User class and a Table class. Additionally, i have a one-to-many association between the User and the Table (one User ultimately owns the table). I am trying to access all of the tables which the user may access (essentially joining both associations).

Additionally, it would be nice to do this this with named_scope (now scope)

Here's what I have so far:

class User < ActiveRecord::Base
  acts_as_authentic

  attr_accessible :email, :password, :password_confirmation
  has_many :feedbacks
  has_many :tables

  has_many :user_table_permissions
  has_many :editableTables, :class_name => "Table", :through => :user_table_permissions

  def allTables
    editableTables.merge(tables)
  end

end