If I have these models: class Project include DataMapper::Resource
property :id, Serial property :name, String has n, :project_roles end class ProjectRole include DataMapper::Resource property :account_id, Integer, :key => true, :required => true property :project_id, Integer, :key => true, :required => true property :role, String # can be anything, e.g. 'manager' / 'developer' / 'observer' belongs_to :account, :key => true belongs_to :project, :key => true end class Account include DataMapper::Resource property :id, Serial property :name, String has n, :project_roles has n, :projects, 'Project', :through => :project_roles # !!! end What I would like to do is something like this: account = Account.last projects = account.projects , where each project would include the 'role' attribute from project_roles join table. I tried using :fields to select the additional attribute has n, :project_roles has n, :projects, 'Project', :through => :project_roles, :fields => Project.properties.collect(&:name) + ["role"] getting, ArgumentError: +options[:fields]+ entry "role" does not map to a property in Project Is there any other way of doing this besides writing sql in datamapper? Any ideas? -- 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.
