kurinosuke (156) [Avatar] Offline
1. Setting up the tables. It would be nice to see a CREATE statement here. I was wondering if a sequence of some sort was being used.

2. A note of caution for those using Postgresql. The id column must be named "id" and a sequence must be assigned to it (serial type). See http://kuriqoo.blogspot.com/2011/02/clojure-clj-record-library-and.html for more details.

3.Actually, the "id" column seems very important when using clj-record. Looking at the source, it assumes that there is an "id" column in every table. This has to be mentioned somewhere. At their homepage, it says : "For the time being, the primary key column of the table must be named ‘id’.". I have to admit that this is very poor. I'd expect better than that...

4. 9.1.2 the user model : at first, I didn't understand where the "db" ref had to be declared. It would be nice to mention that we have to put all this in user.clj. It would also be nice to show how to set the "db" ref in another file (e.g. config.clj) and how to use it from user.clj. (it's In Action after all)

5. Reading records. (user/find-records {:first_name "robert"}) doesn't return any record because the first name is actually "Robert" with a "R". Ok, I'm using Postgresql instead of MySql, so that may be why it doesn't show up. But I really think that it should be "Robert" instead of "robert". Or at least you need to tell why this is not case-sensitive in your case.

-- Aftercomment --
The last paragraph before 9.2 HBase says :
"It’s a fairly straightforward library, and works well enough in systems that need access to databases and aren’t looking to implement very complex schemas. It also adds a find-bysql function, which allows straight SQL access to the database.".
I think this should be mentioned first, to avoid too high expectations. If I had read that first, I might not have thought that using "id" for the primary key of all tables was very poor. I understand that the author wants to keep it clean and simple.