Lenz book - Chapter 7 - Page 199... HELP.
I am getting an error... I am using Ruby 1.8.4, Rails 2.1.0.
NoMethodError in Story#show
Showing story/show.rhtml 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: <h2><%= @story.name %></h2>
2: <p><%= link_to @story.link, @story.link %></p>
I have ensured that the permalinks exist... It's driving me NUTS. :)
I have checked this over and over... If someone could help, please do. :D
class StoryController < ApplicationController
@story = Story.find_by_permalink(params[:permalink])
@story = Story.find(:first, :order => 'RAND()')
@story = Story.new(params[:story])
if request.post? and @story.save
flash[:notice] = 'Story submitted!'
redirect_to :action => 'index'
Okay, I even resorted to copying and pasting from the code archive. I AM FULL OF FAIL. Bleh. It didn't work. Perhaps the problem is with Rails 2.1.0. ???
What... The... F --
It works now... ? I just had to restart WEBrick.
Whatever, eh? Mods, delete this thread whenever... Sorry.