Validates_presence_of generates syntax error

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:inload_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:inload_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:inload_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:inconst_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:inmodule_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:inconstantize’
/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:inpaginate’
app/controllers/admin_controller.rb:12:in list' app/controllers/admin_controller.rb:3:inindex’

/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:inload_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:inload_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:inload_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:inconst_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:inmodule_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:inconstantize’
/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:inpaginate’
/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:inperform_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:incall_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:inperform_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:inperform_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:insend’
/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:inprocess_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:inprocess’
/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:inhandle_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:inservice’
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in run' /usr/lib/ruby/1.8/webrick/server.rb:155:instart_thread’
/usr/lib/ruby/1.8/webrick/server.rb:144:in start' /usr/lib/ruby/1.8/webrick/server.rb:144:instart_thread’
/usr/lib/ruby/1.8/webrick/server.rb:94:in start' /usr/lib/ruby/1.8/webrick/server.rb:89:ineach’
/usr/lib/ruby/1.8/webrick/server.rb:89:in start' /usr/lib/ruby/1.8/webrick/server.rb:79:instart’
/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:indispatch’
/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:inrequire’
/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:innew_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:ingem_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:inrequire’
/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:inrequire’
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:inload_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:inload_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:inload_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:inconst_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:inmodule_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:inconstantize’
/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:inpaginate’
app/controllers/admin_controller.rb:12:in list' app/controllers/admin_controller.rb:3:inindex’
/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:inperform_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:incall_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:inperform_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:inperform_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:insend’
/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:inprocess_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:inprocess’
/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:inhandle_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:inservice’
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in run' /usr/lib/ruby/1.8/webrick/server.rb:155:instart_thread’
/usr/lib/ruby/1.8/webrick/server.rb:144:in start' /usr/lib/ruby/1.8/webrick/server.rb:144:instart_thread’
/usr/lib/ruby/1.8/webrick/server.rb:94:in start' /usr/lib/ruby/1.8/webrick/server.rb:89:ineach’
/usr/lib/ruby/1.8/webrick/server.rb:89:in start' /usr/lib/ruby/1.8/webrick/server.rb:79:instart’
/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:indispatch’
/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:inrequire’
/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:innew_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:ingem_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:inrequire’
/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:inrequire’
script/server:3

Request

Parameters: None

Show session dump


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

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

PLEASE HELP!!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs