So, I finally had to put the book down and take a break. Up to that point, everything had been going fairly well. When I came back to start the next task, a problem seems to have arisen. I have, of course, changed to shovell and typed in "ruby script/server." The form (Figure 6.1 (pg. 154)) appears as it should when "story_controller.rb" appears like this:
class StoryController < ApplicationController
def index
@story = Story.findfirst,
rder => 'RAND()')
end
def new
@story = Story.new
end
end
When I modify the file to read like this:
class StoryController < ApplicationController
def index
@story = Story.findfirst,
rder => 'RAND()')
end
def new
@story = Story.new(params[:story])
if request.post?
@story.save
redirect_to :action => 'index'
end
end
and then click on the submit button, I get a page that reads like this:
SyntaxError in StoryController#new
app/controllers/story_controller.rb:11: parse error, unexpected $, expecting kEND
RAILS_ROOT: ./script/../config/..
Application Trace | Framework Trace | Full Trace
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:203:in `load_without_new_constant_marking'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:203:in `load_file'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:202:in `load_file'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:94:in `require_or_load'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:248:in `load_missing_constant'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:in `const_missing'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:464:in `const_missing'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/inflector.rb:250:in `constantize'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/core_ext/string/inflections.rb:148:in `constantize'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/routing.rb:1284:in `recognize'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:40:in `dispatch'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/rails.rb:73:in `process'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:551:in `process_client'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:550:in `each'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:550:in `process_client'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in `run'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in `initialize'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in `new'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in `run'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:in `initialize'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:in `new'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:in `run'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:956:in `run'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:955:in `each'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:955:in `run'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/bin/mongrel_rails:127:in `run'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/command.rb:199:in `run'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/bin/mongrel_rails:235
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:in `load'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:in `load'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:in `load'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/mongrel.rb:60
D:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
D:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39
D:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
D:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
script/server:3
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:203:in `load_without_new_constant_marking'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:203:in `load_file'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:202:in `load_file'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:94:in `require_or_load'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:248:in `load_missing_constant'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:in `const_missing'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:464:in `const_missing'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/inflector.rb:250:in `constantize'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/core_ext/string/inflections.rb:148:in `constantize'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/routing.rb:1284:in `recognize'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:40:in `dispatch'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/rails.rb:73:in `process'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:551:in `process_client'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:550:in `each'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:550:in `process_client'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in `run'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in `initialize'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in `new'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in `run'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:in `initialize'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:in `new'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:in `run'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:956:in `run'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:955:in `each'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:955:in `run'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/bin/mongrel_rails:127:in `run'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/command.rb:199:in `run'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/bin/mongrel_rails:235
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:in `load'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:in `load'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:in `load'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/mongrel.rb:60
D:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
D:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'
D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39
D:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
D:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
script/server:3
Request
Parameters: {"commit"=>"Save changes", "story"=>{"name"=>"Morgan Library", "link"=>"http://lib.colostate.edu"}}
Show session dump
---
flash: !map:ActionController::Flash::FlashHash {}
Response
Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"}
![]()
If I change the story_controller.rb back, the page looks fine, but doesn't function the way it should.
It's probably something very simple, but, what am I missing?
Thanks.


first,
rder => 'RAND()')



Bookmarks