Skip to content

Instantly share code, notes, and snippets.

@outworlder
Created November 22, 2010 16:27
Show Gist options
  • Select an option

  • Save outworlder/710207 to your computer and use it in GitHub Desktop.

Select an option

Save outworlder/710207 to your computer and use it in GitHub Desktop.
(define-syntax has-many
(syntax-rules (foreign-key:)
([_ parent child method-name foreign-key: column-name]
(define-method (method-name (model parent))
(find-all-by-id child (slot-value model (quote column-name)))))))
(has-many <planet-schematics> <planet-schematics-typemap> typemaps foreign-key: schematicID)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment