Nice work :) I should probably split it to a new topic, but about the belongs_to, in my case sometimes users have an extra userdata table with a bunch of optional things. So I want to basically do something like :@user.udata.find_or_create (which is how it would work in AR), but in DM it calls 'find_or_create' on the result of calling the relationship, rather than the relationship itself.
I guess I'm stuck with something like @user.udata ||= Udata.new :user => @user ? A few more that would have been handy for me in the docs: checking for a property named something: properties.named?(:title) get vs get! vs first to query by primary key. I'm sure its mentioned somewhere but it was a bit 'gotcha' switching from AR. auto_migrate only works with innodb (which seems kinda dumb to me, as it should be pretty easy to change/leave off the 'engine' part as an option). That said, everyone should switch to innodb probably (especially for tests/transaction rollback), so maybe this is a good thing. Perhaps a 'switching from ActiveRecord' page would be useful, since I'm sure a lot of our new users will start with their preconceptions. Something I'm struggling with now is how the rails console deals with DataMapper.finalize/etc. It seems to work I think, you just have to call DataMapper.finalize once yourself. Then it auto-tries to redo it each time you reload!. Sometimes I get stuck with an error in a property name or something that doesn't go away at a reload! and have to restart the console (which sucks since as my other thread stated, it takes 10+ seconds). I'd be curious to hear how other people test things in DM to make sure they're working as expected. I've been running with a little 'testing.rb' script that loads all the dm stuff & a few classes at the top, then I block out the bottom with __END__ and change what I'm testing in it. Then I can just run it from my editor. Its a bit slower going than being able to mess with state/etc as from a console though. Good morning! -Kevin -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.
