<?xml version="1.0" encoding="UTF-8"?>
<ticket>
  <assigned-user-id type="integer" nil="true"></assigned-user-id>
  <attachments-count type="integer">1</attachments-count>
  <closed type="boolean">false</closed>
  <created-at type="datetime">2008-06-09T01:09:02-07:00</created-at>
  <creator-id type="integer">9991</creator-id>
  <milestone-due-on type="datetime">2012-12-31T00:00:00-08:00</milestone-due-on>
  <milestone-id type="integer">27724</milestone-id>
  <number type="integer">31</number>
  <permalink>nested-resources</permalink>
  <priority type="integer">2</priority>
  <project-id type="integer">9779</project-id>
  <raw-data type="binary" nil="true" encoding="base64"></raw-data>
  <state>new</state>
  <tag>&quot;feature patch&quot; routes routing</tag>
  <title>Nested resources</title>
  <updated-at type="datetime">2010-01-21T17:21:35-08:00</updated-at>
  <user-id type="integer">47545</user-id>
  <user-name>Mike (at coverallcrew)</user-name>
  <creator-name>Adam Wiggins</creator-name>
  <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
  <milestone-title>Future</milestone-title>
  <original-body>Ok here's the more controversial feature addition.  Feel free to shoot it down. :)

Nested resources:

@@@
resource 'posts' do
  get do
    # show all posts
  end

  post do
    # create new post
  end
end

resource 'posts/:id' do
  get do
    # show post params[:id]
  end

  delete do
    # destroy post params[:id]
  end

  get 'comments' do
    # show this post's comments
  end
end
@@@

The patch:

http://github.com/adamwiggins/sinatra/commit/b0b67602be141dcc835e91443e3120e5b1acbc9d

I was hesitant about this idea, since I do really like that typing &quot;egrep '^(get|put|post|delete)' myapp.rb&quot; returns all the full URLs.  But for larger apps, having a bit more organization is really nice.  And since it only adds ~20 lines of code and doesn't disrupt any existing syntax, it seemed like a net win overall.

Curious to hear feedback.</original-body>
  <latest-body>Ok here's the more controversial feature addition.  Feel free to shoot it down. :)

Nested resources:

@@@
resource 'posts' do
  get do
    # show all posts
  end

  post do
    # create new post
  end
end

resource 'posts/:id' do
  get do
    # show post params[:id]
  end

  delete do
    # destroy post params[:id]
  end

  get 'comments' do
    # show this post's comments
  end
end
@@@

The patch:

http://github.com/adamwiggins/sinatra/commit/b0b67602be141dcc835e91443e3120e5b1acbc9d

I was hesitant about this idea, since I do really like that typing &quot;egrep '^(get|put|post|delete)' myapp.rb&quot; returns all the full URLs.  But for larger apps, having a bit more organization is really nice.  And since it only adds ~20 lines of code and doesn't disrupt any existing syntax, it seemed like a net win overall.

Curious to hear feedback.</latest-body>
  <original-body-html>&lt;div&gt;&lt;p&gt;
Ok here's the more controversial feature addition.  Feel free to shoot it down. :)
&lt;/p&gt;&lt;p&gt;
Nested resources:
&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;&quot;&gt;resource 'posts' do
  get do
    # show all posts
  end

  post do
    # create new post
  end
end

resource 'posts/:id' do
  get do
    # show post params[:id]
  end

  delete do
    # destroy post params[:id]
  end

  get 'comments' do
    # show this post's comments
  end
end&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
The patch:
&lt;/p&gt;&lt;p&gt;
&lt;a href=&quot;http://github.com/adamwiggins/sinatra/commit/b0b67602be141dcc835e91443e3120e5b1acbc9d&quot;&gt;http://github.com/adamwiggins/si...&lt;/a&gt;
&lt;/p&gt;&lt;p&gt;
I was hesitant about this idea, since I do really like that typing &quot;egrep '^(get|put|post|delete)' myapp.rb&quot; returns all the full URLs.  But for larger apps, having a bit more organization is really nice.  And since it only adds ~20 lines of code and doesn't disrupt any existing syntax, it seemed like a net win overall.
&lt;/p&gt;&lt;p&gt;
Curious to hear feedback.
&lt;/p&gt;&lt;/div&gt;</original-body-html>
  <versions type="array">
    <version type="Ticket::Version">
      <assigned-user-id type="integer">15214</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Ok here's the more controversial feature addition.  Feel free to shoot it down. :)

Nested resources:

@@@
resource 'posts' do
  get do
    # show all posts
  end

  post do
    # create new post
  end
end

resource 'posts/:id' do
  get do
    # show post params[:id]
  end

  delete do
    # destroy post params[:id]
  end

  get 'comments' do
    # show this post's comments
  end
end
@@@

The patch:

http://github.com/adamwiggins/sinatra/commit/b0b67602be141dcc835e91443e3120e5b1acbc9d

I was hesitant about this idea, since I do really like that typing &quot;egrep '^(get|put|post|delete)' myapp.rb&quot; returns all the full URLs.  But for larger apps, having a bit more organization is really nice.  And since it only adds ~20 lines of code and doesn't disrupt any existing syntax, it seemed like a net win overall.

Curious to hear feedback.</body>
      <body-html>&lt;div&gt;&lt;p&gt;
Ok here's the more controversial feature addition.  Feel free to shoot it down. :)
&lt;/p&gt;&lt;p&gt;
Nested resources:
&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;&quot;&gt;resource 'posts' do
  get do
    # show all posts
  end

  post do
    # create new post
  end
end

resource 'posts/:id' do
  get do
    # show post params[:id]
  end

  delete do
    # destroy post params[:id]
  end

  get 'comments' do
    # show this post's comments
  end
end&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
The patch:
&lt;/p&gt;&lt;p&gt;
&lt;a href=&quot;http://github.com/adamwiggins/sinatra/commit/b0b67602be141dcc835e91443e3120e5b1acbc9d&quot;&gt;http://github.com/adamwiggins/si...&lt;/a&gt;
&lt;/p&gt;&lt;p&gt;
I was hesitant about this idea, since I do really like that typing &quot;egrep '^(get|put|post|delete)' myapp.rb&quot; returns all the full URLs.  But for larger apps, having a bit more organization is really nice.  And since it only adds ~20 lines of code and doesn't disrupt any existing syntax, it seemed like a net win overall.
&lt;/p&gt;&lt;p&gt;
Curious to hear feedback.
&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-06-09T01:09:02-07:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9332</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag nil="true"></tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2008-06-09T01:09:02-07:00</updated-at>
      <user-id type="integer">9991</user-id>
      <user-name>Adam Wiggins</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>0.3.0 Sammy</milestone-title>
      <assigned-user-name>Blake Mizerany</assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">15214</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Rereading this, I probably should have mentioned that url paths are concatenated.  So fetching a post's comments would look like this:

@@@
RestClient.get 'http://localhost:4567/posts/1/comments'
@@@</body>
      <body-html>&lt;div&gt;&lt;p&gt;
Rereading this, I probably should have mentioned that url paths are concatenated.  So fetching a post's comments would look like this:
&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;&quot;&gt;RestClient.get 'http://localhost:4567/posts/1/comments'&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-06-09T01:12:44-07:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9332</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag nil="true"></tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2008-06-09T01:12:44-07:00</updated-at>
      <user-id type="integer">9991</user-id>
      <user-name>Adam Wiggins</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>0.3.0 Sammy</milestone-title>
      <assigned-user-name>Blake Mizerany</assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">15214</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>I like that this tidies things up.  Let me play with it for a bit.  This is looking great.</body>
      <body-html>&lt;div&gt;&lt;p&gt;
I like that this tidies things up.  Let me play with it for a bit.  This is looking great.
&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-06-09T16:01:31-07:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9332</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag nil="true"></tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2008-06-09T16:01:31-07:00</updated-at>
      <user-id type="integer">15214</user-id>
      <user-name>Blake Mizerany</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>0.3.0 Sammy</milestone-title>
      <assigned-user-name>Blake Mizerany</assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">15214</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>I'm diggin this, too. :)

I haven't looked at the patch yet but the syntax looks tasty.</body>
      <body-html>&lt;div&gt;&lt;p&gt;
I'm diggin this, too. :)
&lt;/p&gt;&lt;p&gt;
I haven't looked at the patch yet but the syntax looks tasty.
&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-06-10T05:12:26-07:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9332</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag nil="true"></tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2008-06-10T05:12:26-07:00</updated-at>
      <user-id type="integer">17123</user-id>
      <user-name>Ryan Tomayko</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>0.3.0 Sammy</milestone-title>
      <assigned-user-name>Blake Mizerany</assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">15214</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Branch against next:

http://github.com/adamwiggins/sinatra/commits/nested_resources

This patch is still considered experimental and may not be accepted or may change significantly pending design discussions.  So I'm not tagging this one with &quot;pull&quot;</body>
      <body-html>&lt;div&gt;&lt;p&gt;
Branch against next:
&lt;/p&gt;&lt;p&gt;
&lt;a href=&quot;http://github.com/adamwiggins/sinatra/commits/nested_resources&quot;&gt;http://github.com/adamwiggins/si...&lt;/a&gt;
&lt;/p&gt;&lt;p&gt;
This patch is still considered experimental and may not be accepted or may change significantly pending design discussions.  So I'm not tagging this one with &quot;pull&quot;
&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-06-23T13:54:54-07:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9332</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag nil="true"></tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2008-06-23T13:54:54-07:00</updated-at>
      <user-id type="integer">9991</user-id>
      <user-name>Adam Wiggins</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>0.3.0 Sammy</milestone-title>
      <assigned-user-name>Blake Mizerany</assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">15214</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>+1.  I love this idea.  I had one suggestion though, but feel free to tell me to create a new ticket if you think this should be considered separately from this feature.

In your second resource block, where you have the :id parameter in the URL, what if the method blocks yield'ed with the parameters extracted from the URL?  For example:

@@@ruby
resource 'posts/:id' do
  get do |id|
    # show post with id
  end

  delete do |id|
    # destroy post with id
  end

  get 'comments' do |id|
    # show comments of post with id
  end
end
@@@</body>
      <body-html>&lt;div&gt;&lt;ol&gt;
&lt;li&gt;I love this idea.  I had one suggestion though, but feel free to tell me to create a new ticket if you think this should be considered separately from this feature.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;In your second resource block, where you have the :id parameter in the URL, what if the method blocks yield'ed with the parameters extracted from the URL?  For example:&lt;/p&gt;

&lt;p&gt;@@@ruby
resource 'posts/:id' do
  get do |id|&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# show post with id
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;  end&lt;/p&gt;

&lt;p&gt;  delete do |id|&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# destroy post with id
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;  end&lt;/p&gt;

&lt;p&gt;  get 'comments' do |id|&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# show comments of post with id
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;  end
end&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-08-14T19:24:55-07:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- 
:tag: 
</diffable-attributes>
      <milestone-id type="integer">9332</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>feature patch</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2008-08-14T19:24:55-07:00</updated-at>
      <user-id type="integer">5609</user-id>
      <user-name>Dan Kubb (dkubb)</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>0.3.0 Sammy</milestone-title>
      <assigned-user-name>Blake Mizerany</assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">15214</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Wow, I fubared the formatting on that, and I don't have access to edit it after posting.  Here's a gist showing what I mean: http://gist.github.com/5524</body>
      <body-html>&lt;div&gt;&lt;p&gt;Wow, I fubared the formatting on that, and I don't have access to edit it after posting.  Here's a gist showing what I mean: &lt;a href=&quot;http://gist.github.com/5524&quot;&gt;http://gist.github.com/5524&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-08-14T19:26:56-07:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9332</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>feature patch</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2008-08-14T19:26:56-07:00</updated-at>
      <user-id type="integer">5609</user-id>
      <user-name>Dan Kubb (dkubb)</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>0.3.0 Sammy</milestone-title>
      <assigned-user-name>Blake Mizerany</assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">15214</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>I'd like to move this to 0.4 and the redux branch if there's no objections. Feels like the new code layout would be more accepting of such a change.</body>
      <body-html>&lt;div&gt;&lt;p&gt;I'd like to move this to 0.4 and the redux branch if there's no
objections. Feels like the new code layout would be more accepting
of such a change.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-09-07T18:26:02-07:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- 
:milestone: 9332
</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>feature patch</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2008-09-07T18:26:05-07:00</updated-at>
      <user-id type="integer">17123</user-id>
      <user-name>Ryan Tomayko</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title nil="true"></milestone-title>
      <assigned-user-name>Blake Mizerany</assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">17123</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Killer feature. Moving to hoboken and putting on hold for now but this should be fairly easy to add once things settle down.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Killer feature. Moving to hoboken and putting on hold for now
but this should be fairly easy to add once things settle down.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2008-12-30T02:48:32-08:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- 
:milestone: 18496
:state: new
:assigned_user: 15214
</diffable-attributes>
      <milestone-id type="integer">27290</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>hold</state>
      <tag>feature patch</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2008-12-30T02:48:34-08:00</updated-at>
      <user-id type="integer">17123</user-id>
      <user-name>Ryan Tomayko</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>0.9.0 Hoboken</milestone-title>
      <assigned-user-name>Ryan Tomayko</assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">17123</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body></body>
      <body-html></body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-12-30T03:00:38-08:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- 
:state: hold
</diffable-attributes>
      <milestone-id type="integer">27290</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>feature patch</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2008-12-30T03:00:40-08:00</updated-at>
      <user-id type="integer">17123</user-id>
      <user-name>Ryan Tomayko</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>0.9.0 Hoboken</milestone-title>
      <assigned-user-name>Ryan Tomayko</assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">17123</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body></body>
      <body-html></body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-01-07T11:11:12-08:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- 
:milestone: 27290
</diffable-attributes>
      <milestone-id type="integer">27725</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>feature patch</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2009-01-07T11:11:15-08:00</updated-at>
      <user-id type="integer">17123</user-id>
      <user-name>Ryan Tomayko</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>0.9.1</milestone-title>
      <assigned-user-name>Ryan Tomayko</assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">17123</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body></body>
      <body-html></body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-01-17T16:47:45-08:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- 
:milestone: 27725
</diffable-attributes>
      <milestone-id type="integer">27724</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>feature patch</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2009-01-17T16:47:48-08:00</updated-at>
      <user-id type="integer">17123</user-id>
      <user-name>Ryan Tomayko</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>Future</milestone-title>
      <assigned-user-name>Ryan Tomayko</assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body></body>
      <body-html></body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-01-18T14:43:05-08:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- 
:assigned_user: 17123
</diffable-attributes>
      <milestone-id type="integer">27724</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>feature patch</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2009-01-18T14:43:06-08:00</updated-at>
      <user-id type="integer">17123</user-id>
      <user-name>Ryan Tomayko</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>Future</milestone-title>
      <assigned-user-name nil="true"></assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>I've ported the original patch to master. It's available here:

  http://github.com/eoin/sinatra/tree/nested_resources</body>
      <body-html>&lt;div&gt;&lt;p&gt;I've ported the original patch to master. It's available
here:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://github.com/eoin/sinatra/tree/nested_resources&quot;&gt;http://github.com/eoin/sinatra/t...&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-03-29T15:40:59-07:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">27724</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>feature patch</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2009-03-29T15:41:01-07:00</updated-at>
      <user-id type="integer">16789</user-id>
      <user-name>Eoin Hennessy</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>Future</milestone-title>
      <assigned-user-name nil="true"></assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Cool, thanks for porting it.  I keep wanting this - it would make my restful resources in Sinatra so much more succinct.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Cool, thanks for porting it. I keep wanting this - it would make
my restful resources in Sinatra so much more succinct.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-04-07T17:48:44-07:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">27724</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>feature patch</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2009-04-07T17:48:49-07:00</updated-at>
      <user-id type="integer">9991</user-id>
      <user-name>Adam Wiggins</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>Future</milestone-title>
      <assigned-user-name nil="true"></assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>This looks cool to me. I'd like to see it in a future release.</body>
      <body-html>&lt;div&gt;&lt;p&gt;This looks cool to me. I'd like to see it in a future
release.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-09-01T09:33:24-07:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">27724</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>feature patch</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2009-09-01T09:33:26-07:00</updated-at>
      <user-id type="integer">54755</user-id>
      <user-name>David James</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>Future</milestone-title>
      <assigned-user-name nil="true"></assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>+1 really like this.  I was just about to handroll almost the exact same syntax.

Any way this can go into 1.0?</body>
      <body-html>&lt;div&gt;&lt;p&gt;+1 really like this. I was just about to handroll almost the
exact same syntax.&lt;/p&gt;
&lt;p&gt;Any way this can go into 1.0?&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-10-15T08:02:43-07:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">27724</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>feature patch</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2009-10-15T08:02:44-07:00</updated-at>
      <user-id type="integer">15459</user-id>
      <user-name>Nate Wiger</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>Future</milestone-title>
      <assigned-user-name nil="true"></assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Looks like a killer feature. I would love to see this in 1.0!</body>
      <body-html>&lt;div&gt;&lt;p&gt;Looks like a killer feature. I would love to see this in
1.0!&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-11-14T18:00:38-08:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">27724</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>feature patch</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2009-11-14T18:00:41-08:00</updated-at>
      <user-id type="integer">61850</user-id>
      <user-name>jho406 (at gmail)</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>Future</milestone-title>
      <assigned-user-name nil="true"></assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Awesome feature. Was thinking about implementing such thing on my own. Any reason you place this (an all your other code) in lib/sinatra.rb rather than lib/sinatra/base.rb so one could use this without top level mode?</body>
      <body-html>&lt;div&gt;&lt;p&gt;Awesome feature. Was thinking about implementing such thing on
my own. Any reason you place this (an all your other code) in
lib/sinatra.rb rather than lib/sinatra/base.rb so one could use
this without top level mode?&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-12-02T11:09:54-08:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">27724</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>feature patch</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2009-12-02T11:09:59-08:00</updated-at>
      <user-id type="integer">39584</user-id>
      <user-name>Konstantin Haase</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>Future</milestone-title>
      <assigned-user-name nil="true"></assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Here's a patch against Sinatra trunk, with tests, and putting the functionality into Sinatra::Base.  I can also send a github pull request.

I've also put together a Sinatra::Resources extension, although it seems best that this make it in core, since the extension feels like a bit of Rails-esque method override/dispatch magic.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Here's a patch against Sinatra trunk, with tests, and putting
the functionality into Sinatra::Base. I can also send a github pull
request.&lt;/p&gt;
&lt;p&gt;I've also put together a Sinatra::Resources extension, although
it seems best that this make it in core, since the extension feels
like a bit of Rails-esque method override/dispatch magic.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2010-01-04T15:48:04-08:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- 
:tag: feature patch
</diffable-attributes>
      <milestone-id type="integer">27724</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>&quot;feature patch&quot;</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2010-01-04T15:48:08-08:00</updated-at>
      <user-id type="integer">15459</user-id>
      <user-name>Nate Wiger</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>Future</milestone-title>
      <assigned-user-name nil="true"></assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>FYI the Sinatra::Resources extension is at: http://github.com/nateware/sinatra-resources</body>
      <body-html>&lt;div&gt;&lt;p&gt;FYI the Sinatra::Resources extension is at: &lt;a href=
&quot;http://github.com/nateware/sinatra-resources&quot;&gt;http://github.com/nateware/sinatra-resources&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2010-01-04T15:49:03-08:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">27724</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>&quot;feature patch&quot;</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2010-01-04T15:49:03-08:00</updated-at>
      <user-id type="integer">15459</user-id>
      <user-name>Nate Wiger</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>Future</milestone-title>
      <assigned-user-name nil="true"></assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>Nice, Nate!  I've wanted this feature in nearly every sinatra app I've written in the past year.  The extension works beautifully.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Nice, Nate! I've wanted this feature in nearly every sinatra app
I've written in the past year. The extension works beautifully.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2010-01-06T19:01:40-08:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">27724</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>&quot;feature patch&quot;</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2010-01-06T19:01:41-08:00</updated-at>
      <user-id type="integer">9991</user-id>
      <user-name>Adam Wiggins</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>Future</milestone-title>
      <assigned-user-name nil="true"></assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>Good work Nate! This is a feature I'd love to see in Sinatra before 1.0</body>
      <body-html>&lt;div&gt;&lt;p&gt;Good work Nate! This is a feature I'd love to see in Sinatra
before 1.0&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2010-01-14T10:30:53-08:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">27724</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>&quot;feature patch&quot;</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2010-01-14T10:30:55-08:00</updated-at>
      <user-id type="integer">47545</user-id>
      <user-name>Mike (at coverallcrew)</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>Future</milestone-title>
      <assigned-user-name nil="true"></assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body></body>
      <body-html></body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2010-01-14T21:26:11-08:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- 
:tag: &quot;\&quot;feature patch\&quot;&quot;
</diffable-attributes>
      <milestone-id type="integer">27724</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>&quot;feature patch&quot; routes routing</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2010-01-14T21:26:14-08:00</updated-at>
      <user-id type="integer">15459</user-id>
      <user-name>Nate Wiger</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>Future</milestone-title>
      <assigned-user-name nil="true"></assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>From http://groups.google.com/group/sinatrarb/browse_thread/thread/e60f3fa5bc967863

Instead of &quot;resource&quot;, if we called it &quot;relative_to&quot; and concentrated on &quot;/path&quot; routes would be more consistent with Sinatra's DSL and goals:

    relative_to &quot;/posts&quot; do
      get do
        # show all posts
      end

      get &quot;.json&quot; do
         # json feed
      end

      post do
        # create new post
      end

      relative_to &quot;:id&quot; do
        get do |id|
          # show post
        end

        delete do |id|
          # destroy post
        end

        get &quot;comments&quot; do |id|
          # show this post's comments
        end

        get &quot;comments.rss&quot; do |id|
          # newsfeed of comments
        end
      end
    end</body>
      <body-html>&lt;div&gt;&lt;p&gt;From &lt;a href=
&quot;http://groups.google.com/group/sinatrarb/browse_thread/thread/e60f3fa5bc967863&quot;&gt;
http://groups.google.com/group/sinatrarb/browse_thread/thread/e60f3...&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Instead of &quot;resource&quot;, if we called it &quot;relative_to&quot; and
concentrated on &quot;/path&quot; routes would be more consistent with
Sinatra's DSL and goals:&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;relative_to &quot;/posts&quot; do
  get do
    # show all posts
  end

  get &quot;.json&quot; do
     # json feed
  end

  post do
    # create new post
  end

  relative_to &quot;:id&quot; do
    get do |id|
      # show post
    end

    delete do |id|
      # destroy post
    end

    get &quot;comments&quot; do |id|
      # show this post's comments
    end

    get &quot;comments.rss&quot; do |id|
      # newsfeed of comments
    end
  end
end&lt;/code&gt;
&lt;/pre&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2010-01-16T08:04:44-08:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">27724</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>&quot;feature patch&quot; routes routing</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2010-01-16T08:04:49-08:00</updated-at>
      <user-id type="integer">15459</user-id>
      <user-name>Nate Wiger</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>Future</milestone-title>
      <assigned-user-name nil="true"></assigned-user-name>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>One problem I found using this is some of my routes have option elements such as (.:format). I've since resorted to building out each resource as a set of routes the &quot;Sinatra way&quot; (:ie get &quot;/my_resource/:id(:.format) ).

One thing that I keep coming back to is to figure out a way I can namespace a set of routes (a Resource in the context of this discussion) so I can call a before filter on that set and not everything. This would lead to more robust applications but I believe it would take away from the simplicity of Sinatra, which makes it awesome!</body>
      <body-html>&lt;div&gt;&lt;p&gt;One problem I found using this is some of my routes have option
elements such as (.:format). I've since resorted to building out
each resource as a set of routes the &quot;Sinatra way&quot; (:ie get
&quot;/my_resource/:id(:.format) ).&lt;/p&gt;
&lt;p&gt;One thing that I keep coming back to is to figure out a way I
can namespace a set of routes (a Resource in the context of this
discussion) so I can call a before filter on that set and not
everything. This would lead to more robust applications but I
believe it would take away from the simplicity of Sinatra, which
makes it awesome!&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2010-01-21T17:21:30-08:00</created-at>
      <creator-id type="integer">9991</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">27724</milestone-id>
      <number type="integer">31</number>
      <permalink>nested-resources</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag>&quot;feature patch&quot; routes routing</tag>
      <title>Nested resources</title>
      <updated-at type="datetime">2010-01-21T17:21:35-08:00</updated-at>
      <user-id type="integer">47545</user-id>
      <user-name>Mike (at coverallcrew)</user-name>
      <creator-name>Adam Wiggins</creator-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/31</url>
      <milestone-title>Future</milestone-title>
      <assigned-user-name nil="true"></assigned-user-name>
    </version>
  </versions>
  <attachments type="array">
    <attachment type="Attachment">
      <code>1d00ea061fe777fbe50a29d2bd360d8ee0007de9</code>
      <content-type>text/plain</content-type>
      <created-at type="datetime">2010-01-04T15:48:04-08:00</created-at>
      <filename>sinatra_resource.diff</filename>
      <height type="integer" nil="true"></height>
      <id type="integer">367321</id>
      <size type="integer">5557</size>
      <uploader-id type="integer">15459</uploader-id>
      <width type="integer" nil="true"></width>
      <url>http://sinatra.lighthouseapp.com/attachments/367321/sinatra_resource.diff</url>
    </attachment>
  </attachments>
</ticket>
