 
 (defn index
   [{{transaction-id :transaction-id} :params}]
-  (let [attachments (attachments/search
+  (let [transaction (transactions/find-by-id (env :db)
+                                             (Integer. transaction-id))
+        attachments (attachments/search
                       (env :db)
-                      {:transaction-id (Integer. transaction-id)})]
+                      {:transaction-id (:id transaction)})]
     (with-layout "Attachments" {}
       [:div.row
        [:div.col-md-4

          [:th "&nbsp;"]]
         (map attachment-row attachments)]]]
      [:a.btn.btn-primary {:href (format "/transactions/%s/attachments/new" transaction-id)}
       "Add"])))

(defn new-attachment
  ([{{transaction-id :transaction-id} :params :as req}]

            [clj-money.pagination :as pagination]
            [clj-money.validation :as validation]
            [clj-money.models.images :as images] 
            [clj-money.models.transactions :as transactions]
            [clj-money.models.attachments :as attachments])
  (:use [clj-money.web.shared :refer :all]))

