<?xml version="1.0" encoding="UTF-8"?>
<ticket>
  <assigned-user-id type="integer">15214</assigned-user-id>
  <attachments-count type="integer">0</attachments-count>
  <closed type="boolean">true</closed>
  <created-at type="datetime">2008-05-31T12:08:48-07:00</created-at>
  <creator-id type="integer">2948</creator-id>
  <milestone-due-on type="datetime">2008-11-02T00:00:00-07:00</milestone-due-on>
  <milestone-id type="integer">9332</milestone-id>
  <number type="integer">24</number>
  <permalink>running-on-jruby-fails-at-rendering-erb-templates</permalink>
  <priority type="integer">48</priority>
  <project-id type="integer">9779</project-id>
  <raw-data type="binary" nil="true" encoding="base64"></raw-data>
  <state>resolved</state>
  <tag>fixed</tag>
  <title>[FIXED] Running on JRuby Fails at Rendering Layouts</title>
  <updated-at type="datetime">2008-09-07T18:16:31-07:00</updated-at>
  <user-id type="integer">17123</user-id>
  <user-name>Ryan Tomayko</user-name>
  <creator-name>chris (at christopher-schneider)</creator-name>
  <assigned-user-name>Blake Mizerany</assigned-user-name>
  <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/24</url>
  <milestone-title>0.3.0 Sammy</milestone-title>
  <original-body>I'm running JRuby 1.1.2, seeing if Sinatra works.  Rendering ERB templates seems to fail, while rendering Haml templates works fine.

The sinatra app:
@@@ ruby
require '../sinatra/lib/sinatra.rb'

get '/' do
    &quot;Hello World&quot;
end

get '/:foo' do
    erb :foo
end
@@@


The template (views/foo.erb):
@@@
&lt;html&gt;
    &lt;head&gt;&lt;/head&gt;
    &lt;body&gt;Erb rendered&lt;/body&gt;
&lt;/html&gt;
@@@

The error:
@@@
Params:
{&quot;foo&quot;=&gt;&quot;blah&quot;}
            		
LocalJumpError - yield called out of block
@@@</original-body>
  <latest-body>I'm running JRuby 1.1.2, seeing if Sinatra works.  Rendering ERB templates seems to fail, while rendering Haml templates works fine.

The sinatra app:
@@@ ruby
require '../sinatra/lib/sinatra.rb'

get '/' do
    &quot;Hello World&quot;
end

get '/:foo' do
    erb :foo
end
@@@


The template (views/foo.erb):
@@@
&lt;html&gt;
    &lt;head&gt;&lt;/head&gt;
    &lt;body&gt;Erb rendered&lt;/body&gt;
&lt;/html&gt;
@@@

The error:
@@@
Params:
{&quot;foo&quot;=&gt;&quot;blah&quot;}
            		
LocalJumpError - yield called out of block
@@@</latest-body>
  <original-body-html>&lt;div&gt;&lt;p&gt;
I'm running JRuby 1.1.2, seeing if Sinatra works.  Rendering ERB templates seems to fail, while rendering Haml templates works fine.
&lt;/p&gt;&lt;p&gt;
The sinatra app:
&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;require '../sinatra/lib/sinatra.rb'

get '/' do
    &amp;quot;Hello World&amp;quot;
end

get '/:foo' do
    erb :foo
end&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
The template (views/foo.erb):
&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;&quot;&gt;&amp;lt;html&amp;gt;
    &amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;
    &amp;lt;body&amp;gt;Erb rendered&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
The error:
&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;&quot;&gt;Params:
{&amp;quot;foo&amp;quot;=&amp;gt;&amp;quot;blah&amp;quot;}
            		
LocalJumpError - yield called out of block&lt;/code&gt;&lt;/pre&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>I'm running JRuby 1.1.2, seeing if Sinatra works.  Rendering ERB templates seems to fail, while rendering Haml templates works fine.

The sinatra app:
@@@ ruby
require '../sinatra/lib/sinatra.rb'

get '/' do
    &quot;Hello World&quot;
end

get '/:foo' do
    erb :foo
end
@@@


The template (views/foo.erb):
@@@
&lt;html&gt;
    &lt;head&gt;&lt;/head&gt;
    &lt;body&gt;Erb rendered&lt;/body&gt;
&lt;/html&gt;
@@@

The error:
@@@
Params:
{&quot;foo&quot;=&gt;&quot;blah&quot;}
            		
LocalJumpError - yield called out of block
@@@</body>
      <body-html>&lt;div&gt;&lt;p&gt;
I'm running JRuby 1.1.2, seeing if Sinatra works.  Rendering ERB templates seems to fail, while rendering Haml templates works fine.
&lt;/p&gt;&lt;p&gt;
The sinatra app:
&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;require '../sinatra/lib/sinatra.rb'

get '/' do
    &amp;quot;Hello World&amp;quot;
end

get '/:foo' do
    erb :foo
end&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
The template (views/foo.erb):
&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;&quot;&gt;&amp;lt;html&amp;gt;
    &amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;
    &amp;lt;body&amp;gt;Erb rendered&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
The error:
&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;&quot;&gt;Params:
{&amp;quot;foo&amp;quot;=&amp;gt;&amp;quot;blah&amp;quot;}
            		
LocalJumpError - yield called out of block&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-05-31T12:08:48-07:00</created-at>
      <creator-id type="integer">2948</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9332</milestone-id>
      <number type="integer">24</number>
      <permalink>running-on-jruby-fails-at-rendering-erb-templates</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag nil="true"></tag>
      <title>Running on JRuby Fails at Rendering ERB Templates</title>
      <updated-at type="datetime">2008-05-31T12:08:48-07:00</updated-at>
      <user-id type="integer">2948</user-id>
      <user-name>chris (at christopher-schneider)</user-name>
      <creator-name>chris (at christopher-schneider)</creator-name>
      <assigned-user-name>Blake Mizerany</assigned-user-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/24</url>
      <milestone-title>0.3.0 Sammy</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">15214</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>I filed a JRuby bug about this at http://jira.codehaus.org/browse/JRUBY-2599</body>
      <body-html>&lt;div&gt;&lt;p&gt;
I filed a JRuby bug about this at &lt;a href=&quot;http://jira.codehaus.org/browse/JRUBY-2599&quot;&gt;http://jira.codehaus.org/browse/...&lt;/a&gt;
&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-05-31T14:30:37-07:00</created-at>
      <creator-id type="integer">2948</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9332</milestone-id>
      <number type="integer">24</number>
      <permalink>running-on-jruby-fails-at-rendering-erb-templates</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag nil="true"></tag>
      <title>Running on JRuby Fails at Rendering ERB Templates</title>
      <updated-at type="datetime">2008-05-31T14:30:37-07:00</updated-at>
      <user-id type="integer">2948</user-id>
      <user-name>chris (at christopher-schneider)</user-name>
      <creator-name>chris (at christopher-schneider)</creator-name>
      <assigned-user-name>Blake Mizerany</assigned-user-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/24</url>
      <milestone-title>0.3.0 Sammy</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">15214</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>On further investigation, it appears I have a rouge layout in the views directory that I didn't notice. I only had one for erb, and not for haml, which mislead me to think that Erb was the problem.

It appears that layouts in general are the issue, and not erb, haml or any other particular renderer. The error remains the same.

views/layout.erb:
@@@
&lt;html&gt;
&lt;head&gt;&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;Layout rendered&lt;/p&gt;
&lt;%= yield %&gt;
&lt;/body&gt;
&lt;/html&gt;
@@@

views/layout.haml:
@@@
%html
  %body
    #content= yield
@@@

views/foo.haml:
@@@
%p Hello World
@@@

Of course to change to using the haml renderer, you have to change the &quot;erb :foo&quot; line to &quot;haml :foo&quot;.</body>
      <body-html>&lt;div&gt;&lt;p&gt;
On further investigation, it appears I have a rouge layout in the views directory that I didn't notice. I only had one for erb, and not for haml, which mislead me to think that Erb was the problem.
&lt;/p&gt;&lt;p&gt;
It appears that layouts in general are the issue, and not erb, haml or any other particular renderer. The error remains the same.
&lt;/p&gt;&lt;p&gt;
views/layout.erb:
&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;&quot;&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;p&amp;gt;Layout rendered&amp;lt;/p&amp;gt;
&amp;lt;%= yield %&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
views/layout.haml:
&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;&quot;&gt;%html
  %body
    #content= yield&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
views/foo.haml:
&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;&quot;&gt;%p Hello World&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Of course to change to using the haml renderer, you have to change the &quot;erb :foo&quot; line to &quot;haml :foo&quot;.
&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-05-31T14:54:49-07:00</created-at>
      <creator-id type="integer">2948</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9332</milestone-id>
      <number type="integer">24</number>
      <permalink>running-on-jruby-fails-at-rendering-erb-templates</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag nil="true"></tag>
      <title>Running on JRuby Fails at Rendering ERB Templates</title>
      <updated-at type="datetime">2008-05-31T14:54:49-07:00</updated-at>
      <user-id type="integer">2948</user-id>
      <user-name>chris (at christopher-schneider)</user-name>
      <creator-name>chris (at christopher-schneider)</creator-name>
      <assigned-user-name>Blake Mizerany</assigned-user-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/24</url>
      <milestone-title>0.3.0 Sammy</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">15214</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Sinatra exposed a bug in JRuby.  JRuby guys isolate and fix the next day.  They rock.  See the linked bug to the JRuby JIRA to see more.

JRuby 1.1.3 (next release) should contain the fix.</body>
      <body-html>&lt;div&gt;&lt;p&gt;
Sinatra exposed a bug in JRuby.  JRuby guys isolate and fix the next day.  They rock.  See the linked bug to the JRuby JIRA to see more.
&lt;/p&gt;&lt;p&gt;
JRuby 1.1.3 (next release) should contain the fix.
&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-06-06T06:57:36-07:00</created-at>
      <creator-id type="integer">2948</creator-id>
      <diffable-attributes type="yaml">--- 
:title: Running on JRuby Fails at Rendering ERB Templates
</diffable-attributes>
      <milestone-id type="integer">9332</milestone-id>
      <number type="integer">24</number>
      <permalink>running-on-jruby-fails-at-rendering-erb-templates</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>new</state>
      <tag nil="true"></tag>
      <title>[FIXED] Running on JRuby Fails at Rendering Layouts</title>
      <updated-at type="datetime">2008-06-06T06:57:36-07:00</updated-at>
      <user-id type="integer">2948</user-id>
      <user-name>chris (at christopher-schneider)</user-name>
      <creator-name>chris (at christopher-schneider)</creator-name>
      <assigned-user-name>Blake Mizerany</assigned-user-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/24</url>
      <milestone-title>0.3.0 Sammy</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">15214</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Assuming this is resolved. Let me know if we need to reopen.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Assuming this is resolved. Let me know if we need to reopen.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2008-09-07T18:16:24-07:00</created-at>
      <creator-id type="integer">2948</creator-id>
      <diffable-attributes type="yaml">--- 
:tag: 
:state: new
</diffable-attributes>
      <milestone-id type="integer">9332</milestone-id>
      <number type="integer">24</number>
      <permalink>running-on-jruby-fails-at-rendering-erb-templates</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">9779</project-id>
      <state>resolved</state>
      <tag>fixed</tag>
      <title>[FIXED] Running on JRuby Fails at Rendering Layouts</title>
      <updated-at type="datetime">2008-09-07T18:16:31-07:00</updated-at>
      <user-id type="integer">17123</user-id>
      <user-name>Ryan Tomayko</user-name>
      <creator-name>chris (at christopher-schneider)</creator-name>
      <assigned-user-name>Blake Mizerany</assigned-user-name>
      <url>http://sinatra.lighthouseapp.com/projects/9779/tickets/24</url>
      <milestone-title>0.3.0 Sammy</milestone-title>
    </version>
  </versions>
</ticket>
