luminus-framework / luminus

documentation site for Luminus framework
http://www.luminusweb.net/
629 stars 121 forks source link

Possible addition to routes.md documentation. #49

Closed bitfl1pper closed 9 years ago

bitfl1pper commented 9 years ago

I was trying to implement CSRF protection as described in the documentation and received a compiler error Caused by: java.lang.RuntimeException: Unable to resolve symbol: add-tag! in this context

Error was resolved (with the assistance of a very helpful fellow Clojure user) by calling

(parser/add-tag! :csrf-token (fn [_ _] (anti-forgery-field)))

instead of

(add-tag! :csrf-token (fn [_ _] (anti-forgery-field)))

as described in the docs. After that I received another compiler error

Caused by: java.lang.RuntimeException: Unable to resolve symbol: anti-forgery-field in this context

which was resolved by adding

[ring.util.anti-forgery :refer [anti-forgery-field]]

to the ns decl.

As relative new comer to clojure, I was stumped for quite a bit. The project I was working on was created with the

lein new luminus [projectname] +h2

template. I think updating the documentation to have those dependencies explicitly declared might make things a bit clearer to people like me who are jumping around the docs after the tutorial.

ps Really grateful for this framework / your book-- both have been very helpful to me.

yogthos commented 9 years ago

Thanks for the heads up, I fixed the docs for CSRF with the changes. Glad the framework/book is coming in handy. :)