Hi Chris,
I'm getting a strange error with couchrest-0.12.2:
Try this out:
%w(rubygems couchrest).each {|g| require g}
class Foo < CouchRest::Model
use_database CouchRest.database!('
http://127.0.0.1:5984/my-
database')
end
Foo.all
p Foo.design_doc.database
Running this code the first time returns an CouchRest::Database
instance, running it the second time (after the design doc has been
added) I get:
NoMethodError: undefined method `view' for nil:NilClass
from /Library/Ruby/Gems/1.8/gems/jchris-couchrest-0.12.2/lib/
couchrest/core/design.rb:84:in `fetch_view'
from /Library/Ruby/Gems/1.8/gems/jchris-couchrest-0.12.2/lib/
couchrest/core/design.rb:42:in `view'
from /Library/Ruby/Gems/1.8/gems/jchris-couchrest-0.12.2/lib/
couchrest/core/model.rb:392:in `fetch_view'
from /Library/Ruby/Gems/1.8/gems/jchris-couchrest-0.12.2/lib/
couchrest/core/model.rb:383:in `fetch_view_with_docs'
from /Library/Ruby/Gems/1.8/gems/jchris-couchrest-0.12.2/lib/
couchrest/core/model.rb:346:in `view'
from /Library/Ruby/Gems/1.8/gems/jchris-couchrest-0.12.2/lib/
couchrest/core/model.rb:121:in `all'
from (irb):5
from :0
The second time around, saved returns true, saved gets saved (line 363
in model.rb) but it doesn't seem like the design_doc's database value
get's updated.
Cheers
Adam