Displaying 2 results from an estimated 2 matches for "topic_key".
2006 Jan 03
0
habtm and insert_sql
...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''
The structure of topic_subtopic, as you can pa...
2006 Mar 29
0
active record bug?
...cs.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, ''Medications'')
The constraint on topic_subtopic is:
ALTER TABLE ONLY topic_subtopic
ADD CONSTRAIN...