gma/nesta — Issue #89: Use a default title or no title if a child page does not have an %h1
Author: iKs279
Created: 2012-02-15 05:07:30+00:00
State: open

Currently, the parent (category) page crashes while rendering when it attempts to downcase nil on line 288 of models.rb

Basic example:

In category.haml
```ruby
%h1 Category
```

In child.haml
```ruby
Categories: category

# No %h1

%p
In the child.
```

Stack trace:
```
/home/iks/Web/personal/lib/nesta/models.rb:288:in `pages'
/home/iks/Web/personal/lib/nesta/models.rb:285:in `sort'
/home/iks/Web/personal/lib/nesta/models.rb:285:in `pages'
/home/iks/Web/personal/views/page.haml:9:in `evaluate_source'
/var/lib/gems/1.8/gems/tilt-1.3.3/lib/tilt/template.rb:144:in `cached_evaluate'
/var/lib/gems/1.8/gems/tilt-1.3.3/lib/tilt/template.rb:127:in `evaluate'
/var/lib/gems/1.8/gems/tilt-1.3.3/lib/tilt/haml.rb:24:in `evaluate'
/var/lib/gems/1.8/gems/tilt-1.3.3/lib/tilt/template.rb:76:in `render'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:563:in `render'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:463:in `haml'
/home/iks/Web/personal/lib/nesta/overrides.rb:6:in `haml'
./lib/nesta/app.rb:180:in `GET *'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:1151:in `call'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:1151:in `compile!'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:724:in `instance_eval'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:724:in `route_eval'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:708:in `route!'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:758:in `process_route'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:755:in `catch'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:755:in `process_route'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:707:in `route!'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:706:in `each'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:706:in `route!'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:843:in `dispatch!'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:644:in `call!'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:808:in `instance_eval'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:808:in `invoke'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:808:in `catch'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:808:in `invoke'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:644:in `call!'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:629:in `call'
/var/lib/gems/1.8/gems/rack-1.4.1/lib/rack/head.rb:9:in `call'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/showexceptions.rb:21:in `call'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:1272:in `call'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:1303:in `synchronize'
/var/lib/gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:1272:in `call'
/var/lib/gems/1.8/gems/thin-1.3.1/lib/thin/connection.rb:80:in `pre_process'
/var/lib/gems/1.8/gems/thin-1.3.1/lib/thin/connection.rb:78:in `catch'
/var/lib/gems/1.8/gems/thin-1.3.1/lib/thin/connection.rb:78:in `pre_process'
/var/lib/gems/1.8/gems/thin-1.3.1/lib/thin/connection.rb:53:in `process'
/var/lib/gems/1.8/gems/thin-1.3.1/lib/thin/connection.rb:38:in `receive_data'
/var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
/var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
/var/lib/gems/1.8/gems/thin-1.3.1/lib/thin/backends/base.rb:61:in `start'
/var/lib/gems/1.8/gems/thin-1.3.1/lib/thin/server.rb:159:in `start'
/var/lib/gems/1.8/gems/thin-1.3.1/lib/thin/controllers/controller.rb:86:in `start'
/var/lib/gems/1.8/gems/thin-1.3.1/lib/thin/runner.rb:185:in `send'
/var/lib/gems/1.8/gems/thin-1.3.1/lib/thin/runner.rb:185:in `run_command'
/var/lib/gems/1.8/gems/thin-1.3.1/lib/thin/runner.rb:151:in `run!'
/var/lib/gems/1.8/gems/thin-1.3.1/bin/thin:6
/var/lib/gems/1.8/bin/thin:19:in `load'
/var/lib/gems/1.8/bin/thin:19
```