hello everyone i'm new to datamapper. I have an asscoiation like this

 class Term
  include DataMapper::Resource

  property :id, Serial
  property :word, String

  has n, :document, :through => :termdocument

 def self.find?(wrd)
   w = first(:word => wrd)
   w = new(:word => wrd) if wrd.nil?
   return w
  end

 end

 class Document
  include DataMapper::Resource

  property :id,  Serial
  property :title,  String,  :key => true
  property :para, Text

  has n, :term, :through => :termdocument

  def self.find?(doc)
   d = first(:title => doc)
   d = new(:title => doc) if d.nil?
   return d
  end

 end

 class Termdocument
  include DataMapper::Resource

  property :id,  Serial

  belongs_to :term
  belongs_to :documents

 end
------------------------------------------------------------------------------------------------------------------------------
 I get an error ... as follows

 /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/
relationship_chain.rb:49:in `initialize': undefined method `name' for
nil:NilClass (NoMethodError)
  from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/
associations/one_to_many.rb:56:in `new'
  from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/
associations/one_to_many.rb:56:in `setup'
  from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/
associations.rb:122:in `has'
  from DBtest.rb:12
 Can anyone please help me out?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to