I might be misusing associations but should I be able to access a
parent's method from a child? For example:

class Example
  include DataMapper::Resource

  property :id, Serial
  property :created_at, DateTime

  belongs_to :language, key => true
end

class Language
  include DataMapper::Resource

  # property <name>, <type>
  property :id, Serial
  property :name, String
  property :created_at, DateTime

  has n, :examples
end

Should I be able to get the name of Language from example using the
following:

example = Example.first
#<Example @id=1 @created_at=Mon, 28 Jun 2010 10:19:51 -0400
@language_id=1>
example.language.name
ArgumentError: condition [#<DataMapper::Property::Serial
@model=Example @name=:id>] of an unsupported object
DataMapper::PropertySet

The reverse works fine (getting examples for a given language).

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

Reply via email to