Skip to content

Commit

Permalink
Remove logical name
Browse files Browse the repository at this point in the history
  • Loading branch information
ignacio committed Jul 26, 2011
1 parent b225397 commit e8f9ab1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/clj_record/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,8 @@ instance."
(nnext remaining-options))
[top-level-options remaining-options])))

(defmacro create-model [logical-name & init-options]
(let [model-name (last (str-utils/re-split #"\." (name (ns-name *ns*))))
[top-level-options option-groups] (split-out-init-options init-options)
(defmacro create-model [model-name & init-options]
(let [[top-level-options option-groups] (split-out-init-options init-options)
tbl-name (or (top-level-options :table-name) (dashes-to-underscores (pluralize model-name)))
pk-name (or (top-level-options :pk) "id")
optional-defs (defs-from-option-groups model-name option-groups)
Expand All @@ -222,7 +221,7 @@ instance."
(set-db-spec ~model-name ~'db)
(set-table-name ~model-name ~tbl-name)
(set-pk ~model-name ~pk-name)
(def ~logical-name
(def ~model-name
{:model ~model-name
:table (table-name ~model-name)
:metadata (fn [& args#] (apply model-metadata-for ~model-name args#))
Expand Down

0 comments on commit e8f9ab1

Please sign in to comment.