On 2011-02-04 17:17, Adam Ruppe wrote:
Jacob Carlborg wrote:
The class "Post" maps to the database table "posts", no configuration is
necessary. Then you can use the column names in the table as fields to
set and get data, like this:
post = Post.new
post.title = "some title"
post.body = "the body"
post.save # will update the database
Note that you can do this kind of thing with D's compile time
reflection and CTFE as well. That particular example works
in my own DataObject class (except I called it "commitChanges"
instead of "save").
Yeah, I tried to do the same. But in this case the static type system
was kind of in the way of what I wanted to do. This is so much easier
with a dynamic type system.
--
/Jacob Carlborg