I have Users who can "own" Projects. There is only one owner. Users in general can be authorized to view certain projects. Here is my initial stab at this:
class User < ActiveRecord::Base has_many :projects # ownership has_many :project_viewers, :dependent => :destroy has_many :projects, :through => :project_viewers, :uniq => true ... end
class ProjectViewers < ActiveRecord::Base belongs_to :projects belongs_to :users end
class Project < ActiveRecord::Base belongs_to :owner, :class_name => 'User', :foreign_key => 'owner_id' has_many :project_viewers, :dependent => :destroy has_many :users, :through => :project_viewers, :uniq => true ... end
Things appear to work ok until I go to destroy a User, at which point I get:
../activesupport/lib/active_support/dependencies.rb:399:in `to_constant_name': Anonymous modules have no name to be referenced by (eval):1:in `compute_type'
Any help appreciated this fine Sunday!
Thanks,
s.ross