Кажется, я определил источник, как подсказывает сообщение об ошибке AR, но все равно получаю ошибки. Любая идея? Rails 3.2, Ruby 1.9.2
class Document < ActiveRecord::Base
has_many :participations
has_many :users, :through => :participations
has_many :editing_sessions
has_many :editors, :through => :editing_sessions, :source => :users
end
class User < ActiveRecord::Base
has_many :participations
has_many :documents , :through => :participations
has_many :editing_sessions
has_many :open_documents, :through => :editing_sessions, :source => :documents
end
class EditingSession < ActiveRecord::Base
belongs_to :users
belongs_to :documents
end
create_table "editing_sessions", :force => true do |t|
t.integer "user_id"
t.integer "document_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
Console:
u = User.first
=> ... OK
u.editing_sessions
=> []
u.open_documents
=> ActiveRecord::HasManyThroughSourceAssociationNotFoundError: Could not find the source association(s) :document in model EditingSession. Try 'has_many :open_documents, :through => :editing_sessions, :source => <name>'. Is it one of :users or :documents?