In associations between different models, you can avoid setting foreign key identifiers directly using device names, as in this answer . What about self-regulation associations, for example when using acts_as_tree ? Attempt:
forsale:
name: For Sale
parent_id: nil
books:
name: Books
parent: forsale
I get this error:
SQLite3::SQLException: table categories has no column named parent: INSERT INTO "categories" ("name", "parent") VALUES ('Books', 'forsale')
Is there a way to make one refence fixture different in the same class without using explicit identifiers?
Update:
Adding a class name between parentheses, for example, for polymorphic belongs to_to , also does not work. Performing this action:
books:
name: Books
parent: forsale (Category)
Generates random parent_idfor booksinstead of forsaleid.