That seems to be working better now John. I looked over most of the code and it seems like a good start. I'm no expert when it comes to functional programming or Clojure, so I'm not sure how to critic the code exactly. If I was doing the porting I would prolly do it in very OO way, since that's what I'm used to, and that would not be correct.
I noticed that in the init-model macro you are creating a 'defn table [] ...' function in the model namespace and was wondering why you didn't just make it a def instead, since it doesn't take any args? I have an idea for you with the callbacks like, before-create, after-create, etc. In the all-models-metadata in the core.clj you could store the namespace in the hash associated with the model-name on setup. Then in the create function defined in the core.clj you could call the before-create function defined in the model something like: (let-if [bc ('before-create (ns-publics <model-namespace>)] (bc attributes#)) That was just an idea I had, but there could be a better way to do it that's for sure! Of course it's prolly a bit more complex than that since you the before-create function could alter the attributes#, but you get the idea of discovering and calling the appropriate callback function in the model namespace. On Sun, Dec 28, 2008 at 9:49 PM, John D. Hume <duelin.mark...@gmail.com>wrote: > > Ok, please pull the latest and try again. > git clone git://github.com/duelinmarkers/clj-record.git > > The problem was due to something I've seen a couple other messages > about: When running a file as a script, it starts out in the > clojure.core namespace. I was doing (def db {...}) before any (ns ...) > so the db var lived in clojure.core, which made it conveniently (but > sloppily) visible everywhere. Loading from the REPL, however, it was > landing in the user namespace. I've now put it in a config namespace > and required config from the two places that need it. > > Thanks for looking. > -hume. > > On Sun, Dec 28, 2008 at 11:27 PM, John D. Hume <duelin.mark...@gmail.com> > wrote: > > 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. > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---