<?xml version="1.0" encoding="UTF-8"?>
<ticket>
  <assigned-user-id type="integer">33230</assigned-user-id>
  <attachments-count type="integer">2</attachments-count>
  <closed type="boolean">true</closed>
  <created-at type="datetime">2008-11-23T16:25:42-08:00</created-at>
  <creator-id type="integer">23238</creator-id>
  <milestone-due-on type="datetime" nil="true"></milestone-due-on>
  <milestone-id type="integer" nil="true"></milestone-id>
  <number type="integer">26</number>
  <permalink>views-failing-in-trunk</permalink>
  <priority type="integer">41121</priority>
  <project-id type="integer">17807</project-id>
  <raw-data type="binary" nil="true" encoding="base64"></raw-data>
  <state>resolved</state>
  <tag>couchrest model views</tag>
  <title>views failing in trunk</title>
  <updated-at type="datetime">2009-01-24T10:07:14-08:00</updated-at>
  <user-id type="integer">15950</user-id>
  <user-name>Nolan Darilek</user-name>
  <creator-name>hkstar</creator-name>
  <assigned-user-name>J. Chris A.</assigned-user-name>
  <url>http://jchris.lighthouseapp.com/projects/17807/tickets/26</url>
  <original-body>Hi there yet again, 

Views are failing in the current build of trunk. They can be accessed once, but when the model is loaded again, they fail. It's not caught by the specs since they only load the model once.

For a demonstration, save the following file somewhere and run it *twice*. The first time will succeed and output 0,0. The second time you will see an exception: 

/Library/Ruby/Gems/1.8/gems/couchrest-0.10.1/lib/couchrest/core/design.rb:84:in `fetch_view': undefined method `view' for nil:NilClass (NoMethodError)

The example is the Articles class straight out of specs: http://friendpaste.com/sZ4AxdWn

Bug? Or is this just my screwed up system? Wouldn't be the first time, heh.

Thanks a lot as usual...

hk</original-body>
  <latest-body>Hi there yet again, 

Views are failing in the current build of trunk. They can be accessed once, but when the model is loaded again, they fail. It's not caught by the specs since they only load the model once.

For a demonstration, save the following file somewhere and run it *twice*. The first time will succeed and output 0,0. The second time you will see an exception: 

/Library/Ruby/Gems/1.8/gems/couchrest-0.10.1/lib/couchrest/core/design.rb:84:in `fetch_view': undefined method `view' for nil:NilClass (NoMethodError)

The example is the Articles class straight out of specs: http://friendpaste.com/sZ4AxdWn

Bug? Or is this just my screwed up system? Wouldn't be the first time, heh.

Thanks a lot as usual...

hk</latest-body>
  <original-body-html>&lt;div&gt;&lt;p&gt;Hi there yet again,&lt;/p&gt;
&lt;p&gt;Views are failing in the current build of trunk. They can be
accessed once, but when the model is loaded again, they fail. It's
not caught by the specs since they only load the model once.&lt;/p&gt;
&lt;p&gt;For a demonstration, save the following file somewhere and run
it &lt;em&gt;twice&lt;/em&gt;. The first time will succeed and output 0,0. The
second time you will see an exception:&lt;/p&gt;
&lt;p&gt;
/Library/Ruby/Gems/1.8/gems/couchrest-0.10.1/lib/couchrest/core/design.rb:84:in
&lt;code&gt;fetch_view': undefined method&lt;/code&gt;view' for nil:NilClass
(NoMethodError)&lt;/p&gt;
&lt;p&gt;The example is the Articles class straight out of specs:
&lt;a href=&quot;http://friendpaste.com/sZ4AxdWn&quot;&gt;http://friendpaste.com/sZ4AxdWn&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Bug? Or is this just my screwed up system? Wouldn't be the first
time, heh.&lt;/p&gt;
&lt;p&gt;Thanks a lot as usual...&lt;/p&gt;
&lt;p&gt;hk&lt;/p&gt;&lt;/div&gt;</original-body-html>
  <versions type="array">
    <version type="Ticket::Version">
      <assigned-user-id type="integer">33230</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Hi there yet again, 

Views are failing in the current build of trunk. They can be accessed once, but when the model is loaded again, they fail. It's not caught by the specs since they only load the model once.

For a demonstration, save the following file somewhere and run it *twice*. The first time will succeed and output 0,0. The second time you will see an exception: 

/Library/Ruby/Gems/1.8/gems/couchrest-0.10.1/lib/couchrest/core/design.rb:84:in `fetch_view': undefined method `view' for nil:NilClass (NoMethodError)

The example is the Articles class straight out of specs: http://friendpaste.com/sZ4AxdWn

Bug? Or is this just my screwed up system? Wouldn't be the first time, heh.

Thanks a lot as usual...

hk</body>
      <body-html>&lt;div&gt;&lt;p&gt;Hi there yet again,&lt;/p&gt;
&lt;p&gt;Views are failing in the current build of trunk. They can be
accessed once, but when the model is loaded again, they fail. It's
not caught by the specs since they only load the model once.&lt;/p&gt;
&lt;p&gt;For a demonstration, save the following file somewhere and run
it &lt;em&gt;twice&lt;/em&gt;. The first time will succeed and output 0,0. The
second time you will see an exception:&lt;/p&gt;
&lt;p&gt;
/Library/Ruby/Gems/1.8/gems/couchrest-0.10.1/lib/couchrest/core/design.rb:84:in
&lt;code&gt;fetch_view': undefined method&lt;/code&gt;view' for nil:NilClass
(NoMethodError)&lt;/p&gt;
&lt;p&gt;The example is the Articles class straight out of specs:
&lt;a href=&quot;http://friendpaste.com/sZ4AxdWn&quot;&gt;http://friendpaste.com/sZ4AxdWn&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Bug? Or is this just my screwed up system? Wouldn't be the first
time, heh.&lt;/p&gt;
&lt;p&gt;Thanks a lot as usual...&lt;/p&gt;
&lt;p&gt;hk&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-11-23T16:25:42-08:00</created-at>
      <creator-id type="integer">23238</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">26</number>
      <permalink>views-failing-in-trunk</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">17807</project-id>
      <state>new</state>
      <tag>couchrest model views</tag>
      <title>views failing in trunk</title>
      <updated-at type="datetime">2008-11-23T16:25:46-08:00</updated-at>
      <user-id type="integer">23238</user-id>
      <user-name>hkstar</user-name>
      <creator-name>hkstar</creator-name>
      <assigned-user-name>J. Chris A.</assigned-user-name>
      <url>http://jchris.lighthouseapp.com/projects/17807/tickets/26</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">33230</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>I can confirm that this is happening. I will (hopefully have time to) write up a spec for it when I get home tonight.</body>
      <body-html>&lt;div&gt;&lt;p&gt;I can confirm that this is happening. I will (hopefully have
time to) write up a spec for it when I get home tonight.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-12-17T12:36:37-08:00</created-at>
      <creator-id type="integer">23238</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">26</number>
      <permalink>views-failing-in-trunk</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">17807</project-id>
      <state>new</state>
      <tag>couchrest model views</tag>
      <title>views failing in trunk</title>
      <updated-at type="datetime">2008-12-17T12:36:40-08:00</updated-at>
      <user-id type="integer">7631</user-id>
      <user-name>Ray Morgan</user-name>
      <creator-name>hkstar</creator-name>
      <assigned-user-name>J. Chris A.</assigned-user-name>
      <url>http://jchris.lighthouseapp.com/projects/17807/tickets/26</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">33230</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>I can not only confirm this, but I've seen a slightly different variation. I wonder if it isn't just happening the second time the same view is accessed, but the second time *any* view is accessed?

I have an import script that imports two CouchRest::Models with custom model views in the same run. The importer first imports a batch of node objects, then imports ways, all in the same run. The node documents and their associated view load fine. Ways don't load at all, though, and their view fails to be added. I don't know if the triggering behavior is two views on two separate models in the same database or what.</body>
      <body-html>&lt;div&gt;&lt;p&gt;I can not only confirm this, but I've seen a slightly different
variation. I wonder if it isn't just happening the second time the
same view is accessed, but the second time &lt;em&gt;any&lt;/em&gt; view is
accessed?&lt;/p&gt;
&lt;p&gt;I have an import script that imports two CouchRest::Models with
custom model views in the same run. The importer first imports a
batch of node objects, then imports ways, all in the same run. The
node documents and their associated view load fine. Ways don't load
at all, though, and their view fails to be added. I don't know if
the triggering behavior is two views on two separate models in the
same database or what.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-12-18T12:16:19-08:00</created-at>
      <creator-id type="integer">23238</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">26</number>
      <permalink>views-failing-in-trunk</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">17807</project-id>
      <state>new</state>
      <tag>couchrest model views</tag>
      <title>views failing in trunk</title>
      <updated-at type="datetime">2008-12-18T12:16:23-08:00</updated-at>
      <user-id type="integer">15950</user-id>
      <user-name>Nolan Darilek</user-name>
      <creator-name>hkstar</creator-name>
      <assigned-user-name>J. Chris A.</assigned-user-name>
      <url>http://jchris.lighthouseapp.com/projects/17807/tickets/26</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">33230</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>I'd also like to second this bug.  I think I've narrowed it down a tad bit more, though.  At least in my testing, if I have &quot;cast :blah, :as =&gt; 'OtherBlah'&quot; in my model, it fails on the second time of loading.  But if I don't, then the views generate fine (I think).</body>
      <body-html>&lt;div&gt;&lt;p&gt;I'd also like to second this bug. I think I've narrowed it down
a tad bit more, though. At least in my testing, if I have &quot;cast
:blah, :as =&amp;gt; 'OtherBlah'&quot; in my model, it fails on the second
time of loading. But if I don't, then the views generate fine (I
think).&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-12-28T22:26:29-08:00</created-at>
      <creator-id type="integer">23238</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">26</number>
      <permalink>views-failing-in-trunk</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">17807</project-id>
      <state>new</state>
      <tag>couchrest model views</tag>
      <title>views failing in trunk</title>
      <updated-at type="datetime">2008-12-28T22:26:30-08:00</updated-at>
      <user-id type="integer">19603</user-id>
      <user-name>Max Aller</user-name>
      <creator-name>hkstar</creator-name>
      <assigned-user-name>J. Chris A.</assigned-user-name>
      <url>http://jchris.lighthouseapp.com/projects/17807/tickets/26</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">33230</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>K, my previous comment was wrong.

Anyway, after about...3 hours, I've narrowed down one possible solution.  See attached.

Also I wish git made patches from the branch name, not the commit comment :P</body>
      <body-html>&lt;div&gt;&lt;p&gt;K, my previous comment was wrong.&lt;/p&gt;
&lt;p&gt;Anyway, after about...3 hours, I've narrowed down one possible
solution. See attached.&lt;/p&gt;
&lt;p&gt;Also I wish git made patches from the branch name, not the
commit comment :P&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-12-29T21:24:01-08:00</created-at>
      <creator-id type="integer">23238</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">26</number>
      <permalink>views-failing-in-trunk</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">17807</project-id>
      <state>new</state>
      <tag>couchrest model views</tag>
      <title>views failing in trunk</title>
      <updated-at type="datetime">2008-12-29T21:24:05-08:00</updated-at>
      <user-id type="integer">19603</user-id>
      <user-name>Max Aller</user-name>
      <creator-name>hkstar</creator-name>
      <assigned-user-name>J. Chris A.</assigned-user-name>
      <url>http://jchris.lighthouseapp.com/projects/17807/tickets/26</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">33230</assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>Unfortunately, this patch doesn't resolve the problem for me. See &lt;a href=&quot;http://github.com/thewordnerd/lazy_planet/tree/master/lib/lazy_planet/importer/callbacks.rb&quot;&gt;here&lt;/a&gt; for my use, though be aware that I'm using &lt;a href=&quot;http://github.com/thewordnerd/couchrest&quot;&gt;my own branch&lt;/a&gt; with compaction support and my attempt at an automatic/manually-triggered bulk save system, so if you actually expect it to work then you'll need that branch. :)

This code imports data that is saved with nodes first, then ways. The nodes and their associated view_by:external_id are created correctly. Ways, on the other hand, aren't created the same--that is, their view_by:external_id view doesn't seem to save, even though it is created exactly the same in Ruby. It's as if view creation succeeds once and only once, then fails the second time.

Hopefully this gets resolved soon. I'm trying to track it down as well but am not having as much luck as I'd like.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Unfortunately, this patch doesn't resolve the problem for me.
See &lt;a href=&quot;http://github.com/thewordnerd/lazy_planet/tree/master/lib/lazy_planet/importer/callbacks.rb&quot;&gt;
here&lt;/a&gt; for my use, though be aware that I'm using &lt;a href=&quot;http://github.com/thewordnerd/couchrest&quot;&gt;my own branch&lt;/a&gt; with
compaction support and my attempt at an
automatic/manually-triggered bulk save system, so if you actually
expect it to work then you'll need that branch. :)&lt;/p&gt;
&lt;p&gt;This code imports data that is saved with nodes first, then
ways. The nodes and their associated view_by:external_id are
created correctly. Ways, on the other hand, aren't created the
same--that is, their view_by:external_id view doesn't seem to save,
even though it is created exactly the same in Ruby. It's as if view
creation succeeds once and only once, then fails the second
time.&lt;/p&gt;
&lt;p&gt;Hopefully this gets resolved soon. I'm trying to track it down
as well but am not having as much luck as I'd like.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-12-31T09:14:34-08:00</created-at>
      <creator-id type="integer">23238</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">26</number>
      <permalink>views-failing-in-trunk</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">17807</project-id>
      <state>new</state>
      <tag>couchrest model views</tag>
      <title>views failing in trunk</title>
      <updated-at type="datetime">2008-12-31T09:14:35-08:00</updated-at>
      <user-id type="integer">15950</user-id>
      <user-name>Nolan Darilek</user-name>
      <creator-name>hkstar</creator-name>
      <assigned-user-name>J. Chris A.</assigned-user-name>
      <url>http://jchris.lighthouseapp.com/projects/17807/tickets/26</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">33230</assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>To state the psuedo-obvious, I think what's happening is if the design doc isn't getting initialized correctly if it's not being created right there (within that server bootup, I mean).  Not sure why, though.  Setting the database= property on the design doc helped a little, but ended up producing a different error iirc.  I'll take a look at your code tonight.</body>
      <body-html>&lt;div&gt;&lt;p&gt;To state the psuedo-obvious, I think what's happening is if the
design doc isn't getting initialized correctly if it's not being
created right there (within that server bootup, I mean). Not sure
why, though. Setting the database= property on the design doc
helped a little, but ended up producing a different error iirc.
I'll take a look at your code tonight.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-12-31T09:57:38-08:00</created-at>
      <creator-id type="integer">23238</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">26</number>
      <permalink>views-failing-in-trunk</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">17807</project-id>
      <state>new</state>
      <tag>couchrest model views</tag>
      <title>views failing in trunk</title>
      <updated-at type="datetime">2008-12-31T09:57:42-08:00</updated-at>
      <user-id type="integer">19603</user-id>
      <user-name>Max Aller</user-name>
      <creator-name>hkstar</creator-name>
      <assigned-user-name>J. Chris A.</assigned-user-name>
      <url>http://jchris.lighthouseapp.com/projects/17807/tickets/26</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">33230</assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>+1 for Max's patch. Fixed my problem.</body>
      <body-html>&lt;div&gt;&lt;p&gt;+1 for Max's patch. Fixed my problem.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-01-13T14:21:31-08:00</created-at>
      <creator-id type="integer">23238</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">26</number>
      <permalink>views-failing-in-trunk</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">17807</project-id>
      <state>new</state>
      <tag>couchrest model views</tag>
      <title>views failing in trunk</title>
      <updated-at type="datetime">2009-01-13T14:21:37-08:00</updated-at>
      <user-id type="integer">4343</user-id>
      <user-name>Joe Martinez</user-name>
      <creator-name>hkstar</creator-name>
      <assigned-user-name>J. Chris A.</assigned-user-name>
      <url>http://jchris.lighthouseapp.com/projects/17807/tickets/26</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">33230</assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>+1 for Max's patch, works for me too. Thanks Max!</body>
      <body-html>&lt;div&gt;&lt;p&gt;+1 for Max's patch, works for me too. Thanks Max!&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-01-13T17:22:21-08:00</created-at>
      <creator-id type="integer">23238</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">26</number>
      <permalink>views-failing-in-trunk</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">17807</project-id>
      <state>new</state>
      <tag>couchrest model views</tag>
      <title>views failing in trunk</title>
      <updated-at type="datetime">2009-01-13T17:22:25-08:00</updated-at>
      <user-id type="integer">23238</user-id>
      <user-name>hkstar</user-name>
      <creator-name>hkstar</creator-name>
      <assigned-user-name>J. Chris A.</assigned-user-name>
      <url>http://jchris.lighthouseapp.com/projects/17807/tickets/26</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">33230</assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>I applied this patch (although without reproducing the bug). I'll close this ticket, but please reopen if this patch doesn't fix it.</body>
      <body-html>&lt;div&gt;&lt;p&gt;I applied this patch (although without reproducing the bug).
I'll close this ticket, but please reopen if this patch doesn't fix
it.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2009-01-19T14:50:58-08:00</created-at>
      <creator-id type="integer">23238</creator-id>
      <diffable-attributes type="yaml">--- 
:state: new
</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">26</number>
      <permalink>views-failing-in-trunk</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">17807</project-id>
      <state>resolved</state>
      <tag>couchrest model views</tag>
      <title>views failing in trunk</title>
      <updated-at type="datetime">2009-01-19T14:50:59-08:00</updated-at>
      <user-id type="integer">33230</user-id>
      <user-name>J. Chris A.</user-name>
      <creator-name>hkstar</creator-name>
      <assigned-user-name>J. Chris A.</assigned-user-name>
      <url>http://jchris.lighthouseapp.com/projects/17807/tickets/26</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">33230</assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>No, unfortunately this isn't working for me. It may be that view creation isn't interacting well with the bulk_save changes I introduced, which is what I'm using as it drastically speeds up imports and storage space requirements. Here is the error I get:

/var/lib/gems/1.8/gems/rest-client-0.8.2/lib/rest_client.rb:208:in `process_result': HTTP status code 412 (RestClient::RequestFailed)

	from /var/lib/gems/1.8/gems/rest-client-0.8.2/lib/rest_client.rb:178:in `transmit'

	from /usr/lib/ruby/1.8/net/http.rb:543:in `start'

	from /var/lib/gems/1.8/gems/rest-client-0.8.2/lib/rest_client.rb:175:in `transmit'

	from /var/lib/gems/1.8/gems/rest-client-0.8.2/lib/rest_client.rb:114:in `execute_inner'

	from /var/lib/gems/1.8/gems/rest-client-0.8.2/lib/rest_client.rb:106:in `execute'

	from /var/lib/gems/1.8/gems/rest-client-0.8.2/lib/rest_client.rb:93:in `execute'

	from /var/lib/gems/1.8/gems/rest-client-0.8.2/lib/rest_client.rb:53:in `post'

	from /var/lib/gems/1.8/gems/couchrest-0.12.4/lib/couchrest.rb:113:in `post'

	from /var/lib/gems/1.8/gems/couchrest-0.12.4/lib/couchrest/core/database.rb:163:in `bulk_save'

	from /var/lib/gems/1.8/gems/couchrest-0.12.4/lib/couchrest/core/database.rb:127:in `save'

	from /var/lib/gems/1.8/gems/couchrest-0.12.4/lib/couchrest/core/document.rb:41:in `save'

	from /var/lib/gems/1.8/gems/couchrest-0.12.4/lib/couchrest/core/design.rb:55:in `save'

	from /var/lib/gems/1.8/gems/couchrest-0.12.4/lib/couchrest/core/model.rb:452:in `refresh_design_doc'

	from /var/lib/gems/1.8/gems/couchrest-0.12.4/lib/couchrest/core/model.rb:347:in `view'

	from /var/lib/gems/1.8/gems/couchrest-0.12.4/lib/couchrest/core/model.rb:332:in `method_missing'

	from ./bin/../lib/lazy_planet/importer/callbacks.rb:20:in `way'

	from /var/lib/gems/1.8/gems/osmlib-base-0.1.3/lib/OSM/StreamParser.rb:152:in `_end_way'

	from /var/lib/gems/1.8/gems/osmlib-base-0.1.3/lib/OSM/StreamParser.rb:116:in `on_end_element'

	from /var/lib/gems/1.8/gems/osmlib-base-0.1.3/lib/OSM/StreamParser/Expat.rb:42:in `parse'

	from /var/lib/gems/1.8/gems/osmlib-base-0.1.3/lib/OSM/StreamParser/Expat.rb:39:in `parse'

	from ./bin/../lib/lazy_planet/importer/base.rb:14:in `start'

	from bin/lp_import:18


Here's how to duplicate:

1. Check out my project from git://github.com/thewordnerd/lazy_planet.
2. Install the osmlib-base and xmlparser gems. There may be another gem or two needing installed, I haven't packaged this nicely yet. You can eliminate the xmlparser dependency by commenting out the ENV setting in lib/lazy_planet/importer.rb.
3 Download the dataset which I'll hopefully be able to attach as Brazos.osm.
4. Run bin/lp_import localhost:5984/osm path/to/Brazos.osm.
5. You should get the error in a few minutes. This happens when the first way is imported, which is the second view the app tries to create.

Not sure if this is the same issue, but it seems to be related.</body>
      <body-html>&lt;div&gt;&lt;p&gt;No, unfortunately this isn't working for me. It may be that view
creation isn't interacting well with the bulk_save changes I
introduced, which is what I'm using as it drastically speeds up
imports and storage space requirements. Here is the error I
get:&lt;/p&gt;
&lt;p&gt;
/var/lib/gems/1.8/gems/rest-client-0.8.2/lib/rest_client.rb:208:in
&lt;code&gt;process_result': HTTP status code 412
(RestClient::RequestFailed)&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;from /var/lib/gems/1.8/gems/rest-client-0.8.2/lib/rest_client.rb:178:in `transmit'

from /usr/lib/ruby/1.8/net/http.rb:543:in `start'

from /var/lib/gems/1.8/gems/rest-client-0.8.2/lib/rest_client.rb:175:in `transmit'

from /var/lib/gems/1.8/gems/rest-client-0.8.2/lib/rest_client.rb:114:in `execute_inner'

from /var/lib/gems/1.8/gems/rest-client-0.8.2/lib/rest_client.rb:106:in `execute'

from /var/lib/gems/1.8/gems/rest-client-0.8.2/lib/rest_client.rb:93:in `execute'

from /var/lib/gems/1.8/gems/rest-client-0.8.2/lib/rest_client.rb:53:in `post'

from /var/lib/gems/1.8/gems/couchrest-0.12.4/lib/couchrest.rb:113:in `post'

from /var/lib/gems/1.8/gems/couchrest-0.12.4/lib/couchrest/core/database.rb:163:in `bulk_save'

from /var/lib/gems/1.8/gems/couchrest-0.12.4/lib/couchrest/core/database.rb:127:in `save'

from /var/lib/gems/1.8/gems/couchrest-0.12.4/lib/couchrest/core/document.rb:41:in `save'

from /var/lib/gems/1.8/gems/couchrest-0.12.4/lib/couchrest/core/design.rb:55:in `save'

from /var/lib/gems/1.8/gems/couchrest-0.12.4/lib/couchrest/core/model.rb:452:in `refresh_design_doc'

from /var/lib/gems/1.8/gems/couchrest-0.12.4/lib/couchrest/core/model.rb:347:in `view'

from /var/lib/gems/1.8/gems/couchrest-0.12.4/lib/couchrest/core/model.rb:332:in `method_missing'

from ./bin/../lib/lazy_planet/importer/callbacks.rb:20:in `way'

from /var/lib/gems/1.8/gems/osmlib-base-0.1.3/lib/OSM/StreamParser.rb:152:in `_end_way'

from /var/lib/gems/1.8/gems/osmlib-base-0.1.3/lib/OSM/StreamParser.rb:116:in `on_end_element'

from /var/lib/gems/1.8/gems/osmlib-base-0.1.3/lib/OSM/StreamParser/Expat.rb:42:in `parse'

from /var/lib/gems/1.8/gems/osmlib-base-0.1.3/lib/OSM/StreamParser/Expat.rb:39:in `parse'

from ./bin/../lib/lazy_planet/importer/base.rb:14:in `start'

from bin/lp_import:18
&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;Here's how to duplicate:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Check out my project from
git://github.com/thewordnerd/lazy_planet.&lt;/li&gt;
&lt;li&gt;Install the osmlib-base and xmlparser gems. There may be
another gem or two needing installed, I haven't packaged this
nicely yet. You can eliminate the xmlparser dependency by
commenting out the ENV setting in lib/lazy_planet/importer.rb. 3
Download the dataset which I'll hopefully be able to attach as
Brazos.osm.&lt;/li&gt;
&lt;li&gt;Run bin/lp_import localhost:5984/osm path/to/Brazos.osm.&lt;/li&gt;
&lt;li&gt;You should get the error in a few minutes. This happens when
the first way is imported, which is the second view the app tries
to create.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Not sure if this is the same issue, but it seems to be
related.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2009-01-22T09:48:48-08:00</created-at>
      <creator-id type="integer">23238</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">26</number>
      <permalink>views-failing-in-trunk</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">17807</project-id>
      <state>resolved</state>
      <tag>couchrest model views</tag>
      <title>views failing in trunk</title>
      <updated-at type="datetime">2009-01-22T09:48:50-08:00</updated-at>
      <user-id type="integer">15950</user-id>
      <user-name>Nolan Darilek</user-name>
      <creator-name>hkstar</creator-name>
      <assigned-user-name>J. Chris A.</assigned-user-name>
      <url>http://jchris.lighthouseapp.com/projects/17807/tickets/26</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">33230</assigned-user-id>
      <attachments-count type="integer">2</attachments-count>
      <body>OK, this looks like a slightly different issue, so I think this one can stay closed. Please pull from my fork:

git://github.com/thewordnerd/couchrest

The reason my view wasn't being created was that, when Database.save is called for a standard save and there are docs cached for bulk-saving, the bulk save is performed first. I changed the code to perform the individual document save first, then the bulk, so the view is created even if the bulk save fails. This doesn't solve my issue, but it at least ensures the view is created even if another save fails.</body>
      <body-html>&lt;div&gt;&lt;p&gt;OK, this looks like a slightly different issue, so I think this
one can stay closed. Please pull from my fork:&lt;/p&gt;
&lt;p&gt;git://github.com/thewordnerd/couchrest&lt;/p&gt;
&lt;p&gt;The reason my view wasn't being created was that, when
Database.save is called for a standard save and there are docs
cached for bulk-saving, the bulk save is performed first. I changed
the code to perform the individual document save first, then the
bulk, so the view is created even if the bulk save fails. This
doesn't solve my issue, but it at least ensures the view is created
even if another save fails.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2009-01-24T10:07:11-08:00</created-at>
      <creator-id type="integer">23238</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">26</number>
      <permalink>views-failing-in-trunk</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">17807</project-id>
      <state>resolved</state>
      <tag>couchrest model views</tag>
      <title>views failing in trunk</title>
      <updated-at type="datetime">2009-01-24T10:07:14-08:00</updated-at>
      <user-id type="integer">15950</user-id>
      <user-name>Nolan Darilek</user-name>
      <creator-name>hkstar</creator-name>
      <assigned-user-name>J. Chris A.</assigned-user-name>
      <url>http://jchris.lighthouseapp.com/projects/17807/tickets/26</url>
    </version>
  </versions>
  <attachments type="array">
    <attachment type="Attachment">
      <code>22ce8c2c4663faf9faf08bc4d41d4c13ea96c798</code>
      <content-type>text/plain</content-type>
      <created-at type="datetime">2008-12-29T21:24:01-08:00</created-at>
      <filename>0001-Not-sure-why-this-works-but-it-does.patch</filename>
      <height type="integer" nil="true"></height>
      <id type="integer">74361</id>
      <size type="integer">723</size>
      <uploader-id type="integer">19603</uploader-id>
      <width type="integer" nil="true"></width>
      <url>http://jchris.lighthouseapp.com/attachments/74361/0001-Not-sure-why-this-works-but-it-does.patch</url>
    </attachment>
    <attachment type="Attachment">
      <code>0300d3e92ed425742d1691a1c2ed589a81063753</code>
      <content-type>application/octet-stream</content-type>
      <created-at type="datetime">2009-01-22T09:48:49-08:00</created-at>
      <filename>Brazos.osm</filename>
      <height type="integer" nil="true"></height>
      <id type="integer">80888</id>
      <size type="integer">13410580</size>
      <uploader-id type="integer">15950</uploader-id>
      <width type="integer" nil="true"></width>
      <url>http://jchris.lighthouseapp.com/attachments/80888/Brazos.osm</url>
    </attachment>
  </attachments>
</ticket>
