Welcome to Working With Rails

 

Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
Database Doubts..Pls help
2 Posts
Database Doubts..Pls help

I created a view file with a link in it which links it to a database(a ticket db which has name age etc etc in it)

Then i created another link in the same view file which links to another db(a car db which has a description about the car)

the link to the ticket db is working fine but when i click on the cars link it give me the following error..

please anybody help me

NameError in Cars#index

Showing cars/index.html.erb where line #20 raised:

undefined local variable or method `new_cars_path' for #

Extracted source (around line #20):

17: 18:
19: 20:

RAILS_ROOT: /home/rohith/Rohith/ticket Application Trace | Framework Trace | Full Trace

app/views/cars/index.html.erb:20:in _run_erb_47app47views47cars47index46html46erb' app/controllers/cars_controller.rb:7:inindex'

vendor/rails/actionpack/lib/action_view/base.rb:338:in send' vendor/rails/actionpack/lib/action_view/base.rb:338:inexecute' vendor/rails/actionpack/lib/action_view/template_handlers/compilable.rb:29:in send' vendor/rails/actionpack/lib/action_view/template_handlers/compilable.rb:29:inrender' vendor/rails/actionpack/lib/action_view/template.rb:35:in render' vendor/rails/actionpack/lib/action_view/template.rb:22:inrender_template' vendor/rails/actionpack/lib/action_view/base.rb:245:in render_file' vendor/rails/actionpack/lib/action_controller/base.rb:1108:inrender_for_file' vendor/rails/actionpack/lib/action_controller/base.rb:865:in render_with_no_layout' vendor/rails/actionpack/lib/action_controller/base.rb:880:inrender_with_no_layout' vendor/rails/actionpack/lib/action_controller/layout.rb:251:in render_without_benchmark' vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:inrender' vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:8:in realtime' vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:inrender' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:131:in send' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:131:incustom' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:160:in call' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:160:inrespond' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:154:in each' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:154:inrespond' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:107:in respond_to' vendor/rails/actionpack/lib/action_controller/base.rb:1162:insend' vendor/rails/actionpack/lib/action_controller/base.rb:1162:in perform_action_without_filters' vendor/rails/actionpack/lib/action_controller/filters.rb:580:incall_filters' vendor/rails/actionpack/lib/action_controller/filters.rb:573:in perform_action_without_benchmark' vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:inperform_action_without_rescue' /usr/lib/ruby/1.8/benchmark.rb:293:in measure' vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:inperform_action_without_rescue' vendor/rails/actionpack/lib/action_controller/rescue.rb:201:in perform_action_without_caching' vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:inperform_action' vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in cache' vendor/rails/activerecord/lib/active_record/query_cache.rb:8:incache' vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in perform_action' vendor/rails/actionpack/lib/action_controller/base.rb:529:insend' vendor/rails/actionpack/lib/action_controller/base.rb:529:in process_without_filters' vendor/rails/actionpack/lib/action_controller/filters.rb:569:inprocess_without_session_management_support' vendor/rails/actionpack/lib/action_controller/session_management.rb:130:in process' vendor/rails/actionpack/lib/action_controller/base.rb:389:inprocess' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:149:in handle_request' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:indispatch' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in synchronize' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:indispatch' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in dispatch_cgi' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:indispatch' vendor/rails/railties/lib/webrick_server.rb:112:in handle_dispatch' vendor/rails/railties/lib/webrick_server.rb:78:inservice' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in service' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:inrun' /usr/lib/ruby/1.8/webrick/server.rb:173:in start_thread' /usr/lib/ruby/1.8/webrick/server.rb:162:instart' /usr/lib/ruby/1.8/webrick/server.rb:162:in start_thread' /usr/lib/ruby/1.8/webrick/server.rb:95:instart' /usr/lib/ruby/1.8/webrick/server.rb:92:in each' /usr/lib/ruby/1.8/webrick/server.rb:92:instart' /usr/lib/ruby/1.8/webrick/server.rb:23:in start' /usr/lib/ruby/1.8/webrick/server.rb:82:instart' vendor/rails/railties/lib/webrick_server.rb:62:in dispatch' vendor/rails/railties/lib/commands/servers/webrick.rb:66 /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require' /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in require' vendor/rails/activesupport/lib/active_support/dependencies.rb:509:inrequire' vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in new_constants_in' vendor/rails/activesupport/lib/active_support/dependencies.rb:509:inrequire' vendor/rails/railties/lib/commands/server.rb:39 /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:inrequire' script/server:3

app/views/cars/index.html.erb:20:in _run_erb_47app47views47cars47index46html46erb' vendor/rails/actionpack/lib/action_view/base.rb:338:insend' vendor/rails/actionpack/lib/action_view/base.rb:338:in execute' vendor/rails/actionpack/lib/action_view/template_handlers/compilable.rb:29:insend' vendor/rails/actionpack/lib/action_view/template_handlers/compilable.rb:29:in render' vendor/rails/actionpack/lib/action_view/template.rb:35:inrender' vendor/rails/actionpack/lib/action_view/template.rb:22:in render_template' vendor/rails/actionpack/lib/action_view/base.rb:245:inrender_file' vendor/rails/actionpack/lib/action_controller/base.rb:1108:in render_for_file' vendor/rails/actionpack/lib/action_controller/base.rb:865:inrender_with_no_layout' vendor/rails/actionpack/lib/action_controller/base.rb:880:in render_with_no_layout' vendor/rails/actionpack/lib/action_controller/layout.rb:251:inrender_without_benchmark' vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in render' vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:8:inrealtime' vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in render' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:131:insend' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:131:in custom' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:160:incall' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:160:in respond' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:154:ineach' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:154:in respond' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:107:inrespond_to' app/controllers/cars_controller.rb:7:in index' vendor/rails/actionpack/lib/action_controller/base.rb:1162:insend' vendor/rails/actionpack/lib/action_controller/base.rb:1162:in perform_action_without_filters' vendor/rails/actionpack/lib/action_controller/filters.rb:580:incall_filters' vendor/rails/actionpack/lib/action_controller/filters.rb:573:in perform_action_without_benchmark' vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:inperform_action_without_rescue' /usr/lib/ruby/1.8/benchmark.rb:293:in measure' vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:inperform_action_without_rescue' vendor/rails/actionpack/lib/action_controller/rescue.rb:201:in perform_action_without_caching' vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:inperform_action' vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in cache' vendor/rails/activerecord/lib/active_record/query_cache.rb:8:incache' vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in perform_action' vendor/rails/actionpack/lib/action_controller/base.rb:529:insend' vendor/rails/actionpack/lib/action_controller/base.rb:529:in process_without_filters' vendor/rails/actionpack/lib/action_controller/filters.rb:569:inprocess_without_session_management_support' vendor/rails/actionpack/lib/action_controller/session_management.rb:130:in process' vendor/rails/actionpack/lib/action_controller/base.rb:389:inprocess' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:149:in handle_request' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:indispatch' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in synchronize' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:indispatch' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in dispatch_cgi' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:indispatch' vendor/rails/railties/lib/webrick_server.rb:112:in handle_dispatch' vendor/rails/railties/lib/webrick_server.rb:78:inservice' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in service' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:inrun' /usr/lib/ruby/1.8/webrick/server.rb:173:in start_thread' /usr/lib/ruby/1.8/webrick/server.rb:162:instart' /usr/lib/ruby/1.8/webrick/server.rb:162:in start_thread' /usr/lib/ruby/1.8/webrick/server.rb:95:instart' /usr/lib/ruby/1.8/webrick/server.rb:92:in each' /usr/lib/ruby/1.8/webrick/server.rb:92:instart' /usr/lib/ruby/1.8/webrick/server.rb:23:in start' /usr/lib/ruby/1.8/webrick/server.rb:82:instart' vendor/rails/railties/lib/webrick_server.rb:62:in dispatch' vendor/rails/railties/lib/commands/servers/webrick.rb:66 /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require' /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in require' vendor/rails/activesupport/lib/active_support/dependencies.rb:509:inrequire' vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in new_constants_in' vendor/rails/activesupport/lib/active_support/dependencies.rb:509:inrequire' vendor/rails/railties/lib/commands/server.rb:39 /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:inrequire' script/server:3

Request

Parameters:

None

Show session dump


flash: !map:ActionController::Flash::FlashHash {}

:csrf_id: 573795ab309735a1e4af0944e7f3164e

Response

Headers:

{"Content-Type"=>"text/html", "cookie"=>[], "Cache-Control"=>"no-cache"}

Rohini,

I think you want the singular 'new_car_path'.

Enter 'rake routes' in a terminal to see all the routes you have defined.

Bryan

2 Posts
Login to add your message