I am not sure if I am on topic, but I am also working to get touchdb running with rubymotion. and I am struggling to define views and queries properly.
this is WIP code that is trying to exercise views and queries.
here is how I call defineViewNamed:mapBlock:version
@design.defineViewNamed("by_first_name", mapBlock:lambda do |doc, emit|
first_name = doc.objectForKey("first_name")
emit(first_name, doc) unless first_name.nil?
end, version:"1.0")
which returns CouchDesignDocument. I am on motion version 1.29. is this issue of invoking a block in ruby addressed? or am I on different topic?
(main)> delegate = UIApplication.sharedApplication.delegate
=> #<AppDelegate:0x73ea1b0 @server=#<CouchTouchDBServer:0x93ab5a0> @database=#<CouchTouchDBDatabase:0x93acf20> @design=#<CouchDesignDocument:0xb08f430>>
(main)> view = delegate.defineViewByFirstName
=> #<CouchDesignDocument:0xb08f430>
(main)> delegate.query_by_first_name
=> #<CouchQueryEnumerator:0x93ca890>
(main)> delegate.query_by_first_name.count
=> 0 #this is not what I want, but I know why it is returning 0 as I am passing an untitledDocument in mapBlock.
Jim, how's things going with touchdb? if you have sample codes to share, please do. (particularly interested in defining views and queries and working with map/reduce)