Non Master

How to handle a non-master table which is a mapping between 3 master
tables. I have defined the appropriate has_and_belongs_to_many
associations but when I enter data for a course I get 2 entries in
course_prerequisites table
1 2 null
1 null 3

Basically I am not able to make ROR understand that group_id and
exam_id that I am entering belong to a single tuple.
Any solution?

Kumar.

Can I get more specific answer? :frowning:

On 10/13/06, Kumar [email protected] wrote:

exam_id that I am entering belong to a single tuple.
Any solution?

The most straight way is to introduce another model for that non-master
table. It’s not about just creating another AR class, but adjusting your
vision of the problem domain.
Then you’ll be able to use has_many :through (if it will be still be
needed).

On 10/14/06, Kumar [email protected] wrote:

Can I get more specific answer? :frowning:

I doubt you can without being more specific about your problem.

No doubt… I mean I didnt got that answer correctly.
Want in detail. :frowning:

Kumar

Can I get more specific answer? :frowning:

On 10/14/06, Kumar [email protected] wrote:

No doubt… I mean I didnt got that answer correctly.
Want in detail. :frowning:

E.g, you have models A, B and C and a “non-master” table to link them
together.

Then you can create model D that will represent some meanful entity in
your
A / B / C model. Then you can do “A has_many :bs, :through => :d” and
vice
versa.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs