Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6382985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:35:36+00:00 2026-05-25T02:35:36+00:00

I have read this page quite thoroughly: http://datamapper.org/docs/associations If the answer is on there,

  • 0

I have read this page quite thoroughly:

http://datamapper.org/docs/associations

If the answer is on there, it’s simply not expressed in a way I can understand.

I’m very confused about using setting up relationship via Datamapper. The datamapper site above is pretty much all I can find on the topic, and as I’ve said, it hasn’t been particularly helpful.

For example, if I want to create something like the following:

Table: users

id (primary key)
name

Table: attributes

id (pk)
title

Table: user_attributes

id (pk)
user_id (fk to users.id)
attribute_id (fk to attributes.id)
value

This seems simple enough, but it has been prohibitively difficult. Everything I try gives me errors like No relationships named user_attributes or user_attribute in UserUserAttribute (DataMapper::UnknownRelationshipError)

Can someone please tell me the class definitions for this simple mapping, and perhaps point me to a better discussion of DataMapper associations? Below is some of what I’ve tried.

class User
  include DataMapper::Resource

  property :id,   Serial, :key => true
  property :name, String

  has n, :user_attributes, :through=>:attribute
end

class Attribute
  include DataMapper::Resource

  property :id,   Serial, :key => true
  property :name, String

  has n, :user_attributes, :through=>:user
end

class UserAttribute
  include DataMapper::Resource

  belongs_to :user
  belongs_to :attribute
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:35:36+00:00Added an answer on May 25, 2026 at 2:35 am

    I think you’re seeing things like UserUserAttribute because DataMapper is trying to auto-generate an anonymous join class.

    Here’s an article that describes how to make named many-to-many relationships in DataMapper

    You would probably change the example something like this:

    • User -> User
    • Project -> Attribute
    • Collaboration -> UserAttribute
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read this question but it's not quite what I was looking for.
First let me say I have read this useful article thoroughly and am using
I have read quite a lot of R docs, but I can't find anything
I have read this question but it doesn't exactly answer my question. Unfortunately, it
I've read some of the similar questions but they don't quite answer this query
I have read this post about how to test private methods. I usually do
I have read this article from High Scalability about Stack Overflow and other large
I have read this article about 400% boost of your website . This is
I have read this. Jquery checkbox <input type=checkbox name=checkGroup id=all> <input type=checkbox name=checkGroup id=one
I have read over this which sort of gives an explanation of when you'd

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.