Is this a many to many relationship??

So i have one table of data, each data object has two owners from the
users table.

so it's

data table

id owner1_id owner2_id

You need three tables to represent a many-to-many association.

class Owner < ActiveRecord::Base
  has_and_belongs_to_many :datas
end

class Data < ActiveRecord::Base
  has_and_belongs_to_many :owners
end

Table owners:

Robert Walker wrote:

Having owner1_id, owner2_id is in violation of the "First Normal Form
(1NF)" relational database rule.

http://en.wikipedia.org/wiki/First_normal_form#Repeating_groups

On Aug 1, 12:07�am, Morgan Morgan <rails-mailing-l...@andreas-s.net>

the owner1_id corresponds to the student associated with the entry.
the owner2_id corresponds to the teacher associated with the entry.

i just used the owner1 and 2 for sake of simplicity.

there is a table of students and teachers with a user level to decide
what they are thats used for basic information and authentication. it
seemed more logical to treat it that way.. please correct me if i'm
wrong.. i'm a little tarded when it comes to database design.