Make sure that couchrest-hash is set on created design docs during migrations
The current behaviour is that running migrate on a new design doc twice would result in :created and then :migrated, performing the view indexing both times. With this change the results of that example are now :created and then :no_change.
Add support for nested proxies in CouchRest::Model::Utils
class Company < CouchRest::Model::Base
proxy_database_method :id
proxy_for :clients
property :name
design { view :by_name }
end
class Client < CouchRest::Model::Base
proxied_by :company
proxy_database_method :id
proxy_for :invoices
property :name
design { view :by_name }
end
class Invoice < CouchRest::Model::Base
proxied_by :client
property :date
design { view :by_date }
end
Currently, given the above proxying hierarchy, the migration utility functions (and subsequently the rake tasks) would fail because they only traversed one level of proxying. The changes I've made allow the migration to iterate through all the companies, and then all the clients within each company and update the invoice design docs (it's recursive so this could be taken to even more ridiculous depths than I'm using it for). And while I was in there I wrote some more tests for the basic functionality.
Sorry to be continuously bombarding you with pull requests, I just keep hitting edge-cases 😄
I've made a couple of changes here:
Make sure that
couchrest-hash
is set on created design docs during migrationsThe current behaviour is that running
migrate
on a new design doc twice would result in:created
and then:migrated
, performing the view indexing both times. With this change the results of that example are now:created
and then:no_change
.Add support for nested proxies in
CouchRest::Model::Utils
Currently, given the above proxying hierarchy, the migration utility functions (and subsequently the rake tasks) would fail because they only traversed one level of proxying. The changes I've made allow the migration to iterate through all the companies, and then all the clients within each company and update the invoice design docs (it's recursive so this could be taken to even more ridiculous depths than I'm using it for). And while I was in there I wrote some more tests for the basic functionality.
Sorry to be continuously bombarding you with pull requests, I just keep hitting edge-cases 😄