validates_presence_of generates syntax error

L

libsfan01

hi all

im following the tutorial in the book "agile development with rails"
as soon as i get to the point where u first add rails generated
validation i get a syntax error every time:

app/models/product.rb:1: syntax error
class Product < ActiveRecord::Base
validates_presence_of :title, :description, :image_url
end

what ive done is added:

"validates_presence_of :title, :description, :image_url"

to:

"class Product < ActiveRecord::Base
end"

to get:

"class Product < ActiveRecord::Base
validates_presence_of :title, :description, :image_url
end"

which immediately generates a syntax error in "http://localhost:3000/
admin"

when i then remove the line to return the page to its original state,
i get another syntax error?

as shown here (PLEASE HELP!!):

"
SyntaxError in AdminController#index

app/models/product.rb:1: syntax error
class Product < ActiveRecord::Base
end


RAILS_ROOT: script/../config/..
Application Trace | Framework Trace | Full Trace

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:204:in `load_without_new_constant_marking'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:204:in `load_file'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:203:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:203:in `load_file'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:95:in `require_or_load'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:249:in `load_missing_constant'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:453:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:465:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
inflector.rb:251:in `module_eval'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
inflector.rb:251:in `module_eval'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
inflector.rb:251:in `constantize'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
core_ext/string/inflections.rb:148:in `constantize'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
pagination.rb:195:in `paginator_and_collection_for'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
pagination.rb:130:in `paginate'
app/controllers/admin_controller.rb:12:in `list'
app/controllers/admin_controller.rb:3:in `index'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:204:in `load_without_new_constant_marking'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:204:in `load_file'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:203:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:203:in `load_file'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:95:in `require_or_load'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:249:in `load_missing_constant'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:453:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:465:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
inflector.rb:251:in `module_eval'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
inflector.rb:251:in `module_eval'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
inflector.rb:251:in `constantize'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
core_ext/string/inflections.rb:148:in `constantize'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
pagination.rb:195:in `paginator_and_collection_for'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
pagination.rb:130:in `paginate'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
base.rb:1095:in `send'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
base.rb:1095:in `perform_action_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
filters.rb:632:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
filters.rb:634:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
filters.rb:619:in `perform_action_without_benchmark'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
benchmarking.rb:66:in `perform_action_without_rescue'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
benchmarking.rb:66:in `measure'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
benchmarking.rb:66:in `perform_action_without_rescue'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
rescue.rb:83:in `perform_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
base.rb:430:in `send'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
base.rb:430:in `process_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
filters.rb:624:in `process_without_session_management_support'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
session_management.rb:114:in `process'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
base.rb:330:in `process'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/dispatcher.rb:41:in
`dispatch'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/webrick_server.rb:113:in
`handle_dispatch'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/webrick_server.rb:79:in
`service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:144:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:94:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:89:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:89:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:79:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:79:in `start'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/webrick_server.rb:63:in
`dispatch'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/commands/servers/
webrick.rb:59
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:496:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:496:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:496:in `require'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/commands/server.rb:39
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:496:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:496:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:496:in `require'
script/server:3

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:204:in `load_without_new_constant_marking'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:204:in `load_file'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:203:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:203:in `load_file'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:95:in `require_or_load'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:249:in `load_missing_constant'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:453:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:465:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
inflector.rb:251:in `module_eval'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
inflector.rb:251:in `module_eval'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
inflector.rb:251:in `constantize'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
core_ext/string/inflections.rb:148:in `constantize'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
pagination.rb:195:in `paginator_and_collection_for'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
pagination.rb:130:in `paginate'
app/controllers/admin_controller.rb:12:in `list'
app/controllers/admin_controller.rb:3:in `index'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
base.rb:1095:in `send'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
base.rb:1095:in `perform_action_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
filters.rb:632:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
filters.rb:634:in `call_filter'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
filters.rb:619:in `perform_action_without_benchmark'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
benchmarking.rb:66:in `perform_action_without_rescue'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
benchmarking.rb:66:in `measure'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
benchmarking.rb:66:in `perform_action_without_rescue'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
rescue.rb:83:in `perform_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
base.rb:430:in `send'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
base.rb:430:in `process_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
filters.rb:624:in `process_without_session_management_support'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
session_management.rb:114:in `process'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
base.rb:330:in `process'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/dispatcher.rb:41:in
`dispatch'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/webrick_server.rb:113:in
`handle_dispatch'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/webrick_server.rb:79:in
`service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:144:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:94:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:89:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:89:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:79:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:79:in `start'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/webrick_server.rb:63:in
`dispatch'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/commands/servers/
webrick.rb:59
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:496:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:496:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:496:in `require'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/commands/server.rb:39
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:496:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:496:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:496:in `require'
script/server:3

Request

Parameters: None

Show session dump

---
flash: !ruby/hash:ActionController::Flash::FlashHash {}

Response
Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"}"

PLEASE HELP!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,056
Messages
2,570,441
Members
47,125
Latest member
MDBT

Latest Threads

Top