Last active
December 14, 2015 03:59
-
-
Save yedi/5024984 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
(-> (:user_id (get-cur-user request)) | |
db/get-cart-items | |
(partial map | |
#(assoc %1 | |
:cart_item | |
(db/get-dress (:cart_item_id %1)))) ;; breaks here, I want to take the maps from get-cart-items and returns | |
maps where cart-item is a key in map, and a dress from db is the value. | |
(fetched using the cart-item-id from the map) | |
json/write-str) | |
;; java.lang.Exception: Don't know how to write JSON of class clojure.core$partial$fn__4072 | |
;; ========= how come the above throws an error, but the followin works? | |
(def pull-dress | |
(partial map | |
#(assoc %1 | |
:cart_item | |
(db/get-dress (:cart_item_id %1))))) | |
(-> (:user_id (get-cur-user request)) | |
db/get-cart-items | |
pull-dress | |
json/write-str) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment