Posted on July 14, 2008
I’ve just started writing a new app with merb and datamapper, so decided to start out on the edge. The preferred way to do it these days is with sake, a tool for running system wide rake tasks. It’s rather neat, and should (in theory) have made my installation of the edge versions of merb and datamapper extremely easy.
I did hit a couple of issues running them on Ubuntu 7.10, hence this article…
Tagged with: merb |
2 comments
Posted on April 14, 2008
I’ve been trying out Merb recently, and I’m liking it. However, I’ve spent a lot of time stumbling around the interweb looking for examples of what I’ve been trying to achieve. So far I’ve been coming up short. The Merb API docs are good, but you can’t beat a good example.
So I’ll be recording my little revelations as they happen. First up - how to test a controller.
Tagged with: merb |
Posted on April 12, 2008
One of the first things you discover when you start playing with DataMapper is how to specify conditions when searching a database table. This will get you all the chocolate biscuits:
Biscuit.all(:chocolate => true)
After I’d read some of the docs I hoped I might be able to use a similar approach to search my associations. Given that a packet has_many biscuits I hoped I’d be able to do something like this:
packet.biscuits(:broken => true)
I was wrong, and you’d probably only expect that to work if (like me) you hadn’t done much with DataMapper yet. Still, you might.
In the current version (0.3.0) you do it like this:
Biscuit.all(:packet_id => packet.key, :broken => true)
That’s fine. I dare say associations will grow the ability to be searched in due course, but in the meantime, maybe that’ll help clarify it for somebody…
If you’re interested in DataMapper (and merb?) then you might want to check out the open source book on the subject: Life On The Edge With Merb, DataMapper & RSpec.
Tagged with: merb |