tyoc
2009-Oct-01 23:56 UTC
undefined local variable or method `new_new_path'' in an scaffold
Hi there people. My problem come after creating an scaffold like $ script/generate scaffold New title:string content:text I dont know what is the possible cause for this, so when I go to http://127.0.0.1:3000/news I get this error: ###################################################################### NameError in News#index Showing news/index.html.erb where line #22 raised: undefined local variable or method `new_new_path'' for #<ActionView::Base:0xb6fcc4a0> Extracted source (around line #22): 19: 20: <br /> 21: 22: <%= link_to ''New new'', new_new_path %> RAILS_ROOT: /svn/catalogo Application Trace | Framework Trace | Full Trace app/views/news/index.html.erb:22:in `_run_erb_47app47views47news47index46html46erb'' app/controllers/news_controller.rb:7:in `index'' vendor/rails/actionpack/lib/action_view/base.rb:338:in `send'' vendor/rails/actionpack/lib/action_view/base.rb:338:in `execute'' vendor/rails/actionpack/lib/action_view/template_handlers/ compilable.rb:29:in `send'' vendor/rails/actionpack/lib/action_view/template_handlers/ compilable.rb:29:in `render'' vendor/rails/actionpack/lib/action_view/template.rb:35:in `render'' vendor/rails/actionpack/lib/action_view/template.rb:22:in `render_template'' vendor/rails/actionpack/lib/action_view/base.rb:245:in `render_file'' vendor/rails/actionpack/lib/action_controller/base.rb:1108:in `render_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:in `render_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:in `render'' vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb: 8:in `realtime'' vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in `render'' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:131:in `send'' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:131:in `custom'' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:160:in `call'' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:160:in `respond'' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:154:in `each'' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:154:in `respond'' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:107:in `respond_to'' vendor/rails/actionpack/lib/action_controller/base.rb:1162:in `send'' vendor/rails/actionpack/lib/action_controller/base.rb:1162:in `perform_action_without_filters'' vendor/rails/actionpack/lib/action_controller/filters.rb:580:in `call_filters'' vendor/rails/actionpack/lib/action_controller/filters.rb:573:in `perform_action_without_benchmark'' vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'' /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'' vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_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:in `perform_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:in `cache'' vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb: 12:in `perform_action'' vendor/rails/actionpack/lib/action_controller/base.rb:529:in `send'' vendor/rails/actionpack/lib/action_controller/base.rb:529:in `process_without_filters'' vendor/rails/actionpack/lib/action_controller/filters.rb:569:in `process_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:in `process'' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:149:in `handle_request'' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:in `dispatch'' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `synchronize'' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `dispatch'' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in `dispatch'' vendor/rails/railties/lib/webrick_server.rb:112:in `handle_dispatch'' vendor/rails/railties/lib/webrick_server.rb:78: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:173:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'' /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'' 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:in `gem_original_require'' /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'' vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in `require'' vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in `new_constants_in'' vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in `require'' 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:in `require'' script/server:3 app/views/news/index.html.erb:22:in `_run_erb_47app47views47news47index46html46erb'' vendor/rails/actionpack/lib/action_view/base.rb:338:in `send'' vendor/rails/actionpack/lib/action_view/base.rb:338:in `execute'' vendor/rails/actionpack/lib/action_view/template_handlers/ compilable.rb:29:in `send'' vendor/rails/actionpack/lib/action_view/template_handlers/ compilable.rb:29:in `render'' vendor/rails/actionpack/lib/action_view/template.rb:35:in `render'' vendor/rails/actionpack/lib/action_view/template.rb:22:in `render_template'' vendor/rails/actionpack/lib/action_view/base.rb:245:in `render_file'' vendor/rails/actionpack/lib/action_controller/base.rb:1108:in `render_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:in `render_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:in `render'' vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb: 8:in `realtime'' vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in `render'' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:131:in `send'' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:131:in `custom'' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:160:in `call'' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:160:in `respond'' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:154:in `each'' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:154:in `respond'' vendor/rails/actionpack/lib/action_controller/mime_responds.rb:107:in `respond_to'' app/controllers/news_controller.rb:7:in `index'' vendor/rails/actionpack/lib/action_controller/base.rb:1162:in `send'' vendor/rails/actionpack/lib/action_controller/base.rb:1162:in `perform_action_without_filters'' vendor/rails/actionpack/lib/action_controller/filters.rb:580:in `call_filters'' vendor/rails/actionpack/lib/action_controller/filters.rb:573:in `perform_action_without_benchmark'' vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'' /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'' vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_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:in `perform_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:in `cache'' vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb: 12:in `perform_action'' vendor/rails/actionpack/lib/action_controller/base.rb:529:in `send'' vendor/rails/actionpack/lib/action_controller/base.rb:529:in `process_without_filters'' vendor/rails/actionpack/lib/action_controller/filters.rb:569:in `process_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:in `process'' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:149:in `handle_request'' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:in `dispatch'' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `synchronize'' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `dispatch'' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'' vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in `dispatch'' vendor/rails/railties/lib/webrick_server.rb:112:in `handle_dispatch'' vendor/rails/railties/lib/webrick_server.rb:78: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:173:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'' /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'' 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:in `gem_original_require'' /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'' vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in `require'' vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in `new_constants_in'' vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in `require'' 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:in `require'' script/server:3 Request Parameters: None Show session dump --- user_credentials: e80ccd0df823931b60f05b220c5c3b30011dd4a83687871794bc1b04fd4a5f4fc6a3c823366ab80747139a72cdc26b1801109357a57e6474bb07d6a1fc21afd9 :csrf_id: 6b5ad68708dd57c6e2434bfbd71f3438 :return_to: user_credentials_id: 1 flash: !map:ActionController::Flash::FlashHash {} Response Headers: {"Content-Type"=>"text/html", "cookie"=>[], "Cache-Control"=>"no-cache"} ######################################################################
bill walton
2009-Oct-02 01:50 UTC
Re: undefined local variable or method `new_new_path'' in an scaffold
On Thu, 2009-10-01 at 16:56 -0700, tyoc wrote:> Hi there people. > > My problem come after creating an scaffold like > > $ script/generate scaffold New title:string content:text > > I dont know what is the possible cause for this, so when I go to > http://127.0.0.1:3000/news I get this error:Pick another name for your model. ''new'' has meaning to Rails. HTH, Bill