Hi,
I'd like to view each Project by Client, but unsure how to use Datamapper to get this information out. I have my relationships setup like this:
class Client
property :id, Serial
property :name, String
has n, :projects, :foreign_key => "company_id"
end
class Project
include DataMapper::Resource
property :id, Serial
property :title, String
belongs_to :company, "Client"
has n, :stages
end
I would like to output a list like:
Client 1
- Project A
- Project B
- Project C
Client 2
- Project D
- Project E
What's the best way to get this out of Datamapper and what would the view template look like?
Thanks