Hi Travis,

> (def get-id
>   (session/get :uid))
>
> (defn set-user! [user]
>   (session/put! :uid {:_id user}))
>
Only set-user! is a function here. The value of get-id is evaluated at
compile-time.

I don't know about the implementation of noir.session/get, but the error
message suggests that it uses some dynamic var that is unbound at
compile-time. That makes sense since you couldn't reference a session
without an associated request.

Changing get-id to something like:

(defn get-id []
  (session/get :uid))

will probably do what you expect.

=> (meta #'get-id)
> {:ns #<Namespace app-admin.models.current-user>, :name get-id}
>
> So it's there, the fn is bound [...]
>

Actually no, you're looking up the metadata on the var, not the value.
Observe the following:

user> (def foo)
#'user/foo
user> foo
#<Unbound Unbound: #'user/foo>
user> (meta #'foo)
{:ns #<Namespace user>, :name foo, :line 1, :file "NO_SOURCE_FILE"}

See also http://clojure.org/vars

Regards,
Stuart

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to