The db configuration isn't reasonable at the moment. You can run clj_record/test/main.clj as a script but not load it from the REPL. Let me see if I can get it to work both ways and push an update.
On Sun, Dec 28, 2008 at 6:28 PM, Brian Doyle <brianpdo...@gmail.com> wrote: > Having used Rails myself I wanted to check this out and play with it. I'm > having some > trouble just loading the clj_record/core.clj file though: > > 1:1 user=> (load-file "clj_record/core.clj") > java.lang.Exception: Unable to resolve symbol: db in this context > (core.clj:19) > > I'm sure it's something I'm doing wrong but I do have derby.jar on my > classpath. Thanks. > > > On Sat, Dec 27, 2008 at 1:48 PM, John D. Hume <duelin.mark...@gmail.com> > wrote: >> >> Hi all, >> As a learning exercise, I've started working on a sort of clojure >> clone of ActiveRecord (from Rails). You can see it here: >> http://github.com/duelinmarkers/clj-record/tree/master >> >> The model used in the tests is defined in files here: >> >> http://github.com/duelinmarkers/clj-record/tree/master/clj_record/test/model >> >> And the tests most worth reading are: >> >> http://github.com/duelinmarkers/clj-record/tree/master/clj_record/test/core-test.clj >> >> http://github.com/duelinmarkers/clj-record/tree/master/clj_record/test/associations-test.clj >> >> I'd be interested in any feedback about issues you see, idioms I could >> be using that I'm not, suggestions on testing approach, or other >> comments or questions. >> >> One style question I'm particularly interested in is what people think >> the model setup should look like. Currently I've got it implemented to >> allow a minimum of punctuation: >> >> (cljrec/init-model >> (has-many products)) >> >> But is it bad form to use the fact that macros don't evaluate >> arguments to allow all those naked symbols? For consistency with ns it >> seems it would be preferable to make has-many a keyword: >> >> (cljrec/init-model >> (:has-many products)) >> >> (There actually is a has-many method that gets invoked by init-model, >> but that's an implementation detail.) >> >> My gut says the least confusing approach for a user would be this. >> >> (cljrec/init-model >> (:has-many :products)) >> >> ... but something seems weird to me about both :has-many and :products >> being keywords, where :has-many is a magic keyword and :products is a >> name being introduced. (Note it doesn't define a var called 'products >> but does create 'find-products and 'destroy-products functions.) >> >> Note that I'm using clojure.contrib.sql and not worrying about the >> constantly opening and closing connections. Obviously I'd need some >> way of wrapping a single db transaction around a bunch of expressions >> to make this a generally useful library. But that's not the point >> right now. >> >> Thanks. >> -hume. >> -- >> http://elhumidor.blogspot.com/ >> >> > > > > > -- http://elhumidor.blogspot.com/ --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---