I’m a Rails newbie and am working my way through Simply Rails 2 by
Patrick Lenz.
Have run into a problem on page 207 of the book; this is the error I
run into when I fire up my server and open up httpL//localhost:3000/
stories/new I have posted the error message and trace below.
Thanks in advance for your help.
Showing app/views/stories/show.html.rb where line #1 raised:
You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.name
Extracted source (around line #1):
1:
<%= @story.name %>
2:
<%= link_to @story.link, @story.link %>
RAILS_ROOT: /Users/pdenlinger/Sites/In_Development/shovell
Application Trace | Framework Trace | Full Trace
app/views/stories/show.html.rb:1
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/
renderable.rb:39:in send' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/ renderable.rb:39:in
render’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/
template.rb:73:in render_template' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/base.rb: 256:in
render’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/base.rb:
367:in _render_with_layout' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/base.rb: 254:in
render’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
base.rb:1174:in render_for_file' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ base.rb:896:in
render_without_benchmark’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
benchmarking.rb:51:in render' /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/ core_ext/benchmark.rb:8:in
realtime’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
benchmarking.rb:51:in render' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ base.rb:868:in
render_without_benchmark’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
benchmarking.rb:51:in render' /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/ core_ext/benchmark.rb:8:in
realtime’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
benchmarking.rb:51:in render' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ base.rb:1248:in
default_render’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
base.rb:1259:in perform_action_without_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ filters.rb:617:in
call_filters’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
filters.rb:610:in perform_action_without_benchmark' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ benchmarking.rb:68:in
perform_action_without_rescue’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
benchmarking.rb:68:in perform_action_without_rescue' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ rescue.rb:136:in
perform_action_without_caching’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
caching/sql_cache.rb:13:in perform_action' /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ connection_adapters/abstract/query_cache.rb:34:in
cache’
/Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/
query_cache.rb:8:in cache' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ caching/sql_cache.rb:12:in
perform_action’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
base.rb:524:in send' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ base.rb:524:in
process_without_filters’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
filters.rb:606:in process_without_session_management_support' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ session_management.rb:134:in
process’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
base.rb:392:in process' /Library/Ruby/Gems/1.8/gems/rails-2.2.2/lib/webrick_server.rb:74:in
service’
/Library/Ruby/Gems/1.8/gems/rails-2.2.2/lib/commands/servers/
webrick.rb:66
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/
dependencies.rb:153:in require' /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:521:in
new_constants_in’
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/
dependencies.rb:153:in `require’
/Library/Ruby/Gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49