Hi Everyone,
I’m a newbie to Rails, and I just finished going through the cookbook
tutorial. I’m now trying to build my own application, and I’m trying to
add more inputs to the edit view to modify data in other tables. Below
is the controller code where I am having trouble. PartsLocation is
another table (like Part) in the database, and that is the line where I
get the error.
class PartController < ApplicationController
scaffold :part
def list
@parts = Part.find_all
end
def edit
@part = Part.find(@params["id"])
@partslocation = PartsLocation.find(@params["partnumber"])
end
end
Below is the error I am seeing related to the PartsLocation table, but I
have no idea why PartsLocation is uninitialized, but Part is
initialized. Any help is appreciated!
Thanks,
Paul
NameError in Part#edit
uninitialized constant PartsLocation
RAILS_ROOT: ./script/…/config/…
Application Trace | Framework Trace | Full Trace
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:200:in
const_missing' #{RAILS_ROOT}/app/controllers/part_controller.rb:10:in
edit’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:200:in
const_missing' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:853:in
perform_action_without_filters’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/filters.rb:332:in
perform_action_without_benchmark' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/1.8/benchmark.rb:293:in measure' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/rescue.rb:82:in
perform_action' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:369:in
process_without_session_management_support’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/session_management.rb:116:in
process' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:38:in
dispatch’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:117:in
handle_dispatch' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:83:in
service’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in
service' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in
run’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/1.8/webrick/server.rb:173:in
start_thread' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/1.8/webrick/server.rb:162:in
start_thread’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/1.8/webrick/server.rb:95:in start' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/1.8/webrick/server.rb:92:in
start’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/1.8/webrick/server.rb:23:in start' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/1.8/webrick/server.rb:82:in
start’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:69:in
dispatch' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/servers/webrick.rb:59 C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:214:in
require' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/server.rb:28 C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:214:in
`require’
script/server:3
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:200:in
const_missing' #{RAILS_ROOT}/app/controllers/part_controller.rb:10:in
edit’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:853:in
perform_action_without_filters' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/filters.rb:332:in
perform_action_without_benchmark’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/1.8/benchmark.rb:293:in
measure’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/rescue.rb:82:in
perform_action’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:369:in
process_without_session_management_support' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/session_management.rb:116:in
process’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:38:in
dispatch' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:117:in
handle_dispatch’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:83:in
service' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in
service’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in
run' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/1.8/webrick/server.rb:173:in
start_thread’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/1.8/webrick/server.rb:162:in
start_thread' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/1.8/webrick/server.rb:95:in
start’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/1.8/webrick/server.rb:92:in start' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/1.8/webrick/server.rb:23:in
start’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/1.8/webrick/server.rb:82:in start' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:69:in
dispatch’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/servers/webrick.rb:59
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:214:in
require’
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/server.rb:28
C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require' C:/RUBYON~1/INSTAN~1.0/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:214:in
require’
script/server:3
This error occured while loading the following files:
parts_location.rb
Request
Parameters: {“id”=>“1”}
Response
Headers: {“cookie”=>[], “Cache-Control”=>“no-cache”}