Created
June 10, 2013 11:36
-
-
Save ccfontes/5748146 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn insert | |
"Insert user registration invitation." | |
[to_email] | |
(let [invite-id (make-random)] | |
(db/insert :invites | |
{:id invite-id | |
:to_email to_email | |
:created_at (to-sql-date (now)) | |
:users_id (app.session/get :id)}) | |
(.toString invite-id))) | |
; db/insert call to the function below | |
(defn insert [table & [record]] | |
"insert that assumes all tables have ids" | |
(let [record (filter-existent-columns table record) | |
record (assoc record :id (or (:id record) (app.session/get :id)))] | |
(korma.core/insert table | |
(values record)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment