[QUOTE=pdenlinger;3314169]
Code:
class StoryController < ApplicationController
def index
@story = Story.find(:first, :order=>'RAND()')
def new
@story = Story.new(params[:story])
if request.post?
@story.save
redirect_to :action => 'index'
end
end
You've got a method nested within a method. "index" and "new" should be individual methods. Here's the fix:
Code:
class StoryController < ApplicationController
def index
@story = Story.find(:first, :order=>'RAND()')
end
def new
@story = Story.new(params[:story])
if request.post?
@story.save
redirect_to :action => 'index'
end
end
Bookmarks