class Procedure
include DataMapper::Resource

property :id, Serial
property :title, String
property :body, String
property :create_date, DateTime
property :last_reviewed, DateTime

has n, :related_procedures
has n, :procedures, :through => :related_procedures

has n, :procedure_authors
has n, :users, :through => :Procedure_authors

has n, :procedure_endorsements
has n, :users, :through => :procedure_endorsements

end

class RelatedProcedure
include DataMapper::Resource

property :parent_procedure_id, Integer, :key => true
property :child_procedure_id, Integer, :key => true

belongs_to :procedure

end


class ProcedureAuthor
include DataMapper::Resource

property :id, Serial

belongs_to :procedure
belongs_to :user

end

class User
include DataMapper::Resource

property :id, Serial
property :login, String
property :title, String
property :first_name, String
property :last_name, String

has n, :procedure_authors
has n, :procedures, :through => :procedure_authors

has n, :procedure_endorsements
has n, :procedures, :through => :procedure_endorsements

end

nick = User[1]
sequence = Procedure [1]

ProcedureAuthor.new(:User => nick, :Procedure => sequence)

NameError: uninitialized constant ProcedureAuthor::Procedure_association
from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.6/lib/dm-core/associations/many_to_one.rb:21:in `Procedure='
from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.6/lib/dm-core/resource.rb:498:in `send'
from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.6/lib/dm-core/resource.rb:498:in `attributes='
from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.6/lib/dm-core/resource.rb:494:in `each_pair'
from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.6/lib/dm-core/resource.rb:494:in `attributes='
from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.6/lib/dm-core/resource.rb:576:in `initialize'
from (irb):7:in `new'
from (irb):7
from :0