Hello,
After searching on the net, this group and asking to the persons that
could help me, I had a problem with BelongsTo for ActiveRecord
My problem is the following:
I'm building a Quiz form, and not really having knowledge in
ActiveRecord, I made my tables more for SQL statements.
[For the Tables name and data type, I'll use the C# names)
I have three tables in this problem:
Quiz, the principal table.
Prize, to store the prizes to be won.
QuizImage to store images for both tables above.
In QuizImage table, I have a column RelatedTable (string) and a column
RelatedKey (Guid).
RelatedTable is supposed to store "quiz" or "prize", and RelatedKey
will store the Guid of the associated object.
My problem is to map it:
I have put HasMany statement in the two other tables, but I have an
error/problem in QuizImage:
How can I map RelatedKey, using BelongsTo?
(I use cobra files along with nant because it was already like that
when I started on this project)
has BelongsTo("related_key", type=Quiz.getType)
has BelongsTo("related_key", type=Prize.getType)
Obviously, it doesn't compile, but if I remove one or both of them, I
have an error while executing.
If there could be a solution other that having two nullable foreign
key in the table, it would be good as the quiz is only a little part
of the website.
Thank in advance to those who will read and try to answer me, and
sorry if I missed the solution somewhere in my searches.
Felix
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" 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/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---