Help me with choosing relations between tables

My app lets users to create educational tests on various subjects, and
then
another users can complete them.
Each User has some kind of Profile. There should be opportunity to add
tests they like in their profiles, so they don’t need to seatch it it
then
they want to complete it again. The problem is that I don’t know what
relations should be between test and profile.
I don’t want them belong to each other, because the logic is not like
they
belong to each other, User can simly add shortcut and easily find
required
test from his profile.
So I can do this without a relation? Or I can’t?

On 17 April 2013 15:07, Barry [email protected] wrote:

My app lets users to create educational tests on various subjects, and then
another users can complete them.
Each User has some kind of Profile. There should be opportunity to add tests
they like in their profiles, so they don’t need to seatch it it then they
want to complete it again. The problem is that I don’t know what relations
should be between test and profile.
I don’t want them belong to each other, because the logic is not like they
belong to each other, User can simly add shortcut and easily find required
test from his profile.
So I can do this without a relation? Or I can’t?

What are the attributes of a Profile object?
Can a use have more than one profile?
Can a profile be associated with more that one user?
I presume a profile can have multiple tests
Can a test be in more than one profile?

Colin

  1. Just Added Tests
  2. No
    3)No
  3. Yes
  4. Yes
    Basically it is like has many tests and belongs to many tests

, 17 2013 ., 18:12:17 UTC+4 Colin L. :

On 17 April 2013 15:46, Barry [email protected] wrote:

I have re-ordered your reply so it makes sense, please don’t top post.
Thanks

they
What are the attributes of a Profile object?

  1. Just Added Tests

Can a use have more than one profile?

  1. No

Can a profile be associated with more that one user?

3)No

I presume a profile can have multiple tests

  1. Yes

Can a test be in more than one profile?

  1. Yes
    Basically it is like has many tests and belongs to many tests

I don’t understand why you have a Profile object at all, is it not
just part of the User?
As you say, the relation between tests and profile (or user) is
has_and_belongs_to_many or has_many through. I prefer has_many
through as I find it easier to think about. Have a look at the Rails
Guide on ActiveRecord Relations if you don’t understand how to do
this.

Colin