Displaying 2 results from an estimated 2 matches for "topic_subtopic".
2006 Mar 29
0
active record bug?
...IS THE TOPIC ID: 3126
# i explicitly select the topic:
Topic Load (0.000649) SELECT * FROM topics WHERE (topics.id = 3126)
LIMIT 1
# and print out a logger statement showing that the topic exists:
topic exists
TopicSubtopic Create (0.000000) PGError: ERROR: insert or update on
table "topic_subtopic" violates foreign key constraint
"fk_topic_subtopic_subtopic_1"
DETAIL: Key (child_topic_key)=(3126) is not present in table "topics".
: INSERT INTO topic_subtopic ("child_topic_key", "topic_key",
"display_header") VALUES(3126, 2, ''M...
2006 Jan 03
0
habtm and insert_sql
...resql database where one of the join tables has an
ID column, so I had to set up the association with a custom :finder_sql
attribute, as follows:
class Topic < ActiveRecord::Base
[...]
has_and_belongs_to_many :child_documents, :class_name => "Document",
:join_table => "topic_subtopic",
:foreign_key => "topic_key", :association_foreign_key =>
"child_topic_key",
:finder_sql => ''select t.*, ts.display_header from topics t,
topic_subtopic ts where t.id = ts.child_topic_key and ts.topic_key =
#{id} and url is not null''...