Ron DiFrango
2005-Aug-12 19:27 UTC
RE: RE: Another newbie one....Primary Kye and table overloading
Did that and got the the following: Code: class InteriorSelections < ActiveRecord::Base set_table_name "interior_selections" set_primary_key "selection_id" end NameError in Interior_selections#index uninitialized constant InteriorSelection script/server:49 Show framework trace <http://127.0.0.1:3000/InteriorSelections#> c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/dependencies.rb:186:in `const_missing' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/core_ext/string/../../inflector.rb:59:in `const_get' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/core_ext/string/../../inflector.rb:59:in `constantize' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/core_ext/string/../../inflector.rb:58:in `inject' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/core_ext/string/../../inflector.rb:58:in `each' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/core_ext/string/../../inflector.rb:58:in `inject' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/core_ext/string/../../inflector.rb:58:in `constantize' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/core_ext/string/inflections.rb:44:in `constantize' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/pagination.rb:169:in `paginator_and_collection_for' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/pagination.rb:111:in `paginate' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/scaffolding.rb:101:in `list' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/scaffolding.rb:94:in `index' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:in `send' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:in `perform_action_without_filters' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:295:in `perform_action_without_benchmark' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in `perform_action_without_rescue' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in `measure' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in `perform_action_without_rescue' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/rescue.rb:80:in `perform_action' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in `send' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in `process' c:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb:32:in `dispatch' c:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:105:in `handle_dispatch' c:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:71:in `service' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run' c:/ruby/lib/ruby/1.8/webrick/server.rb:155:in `start_thread' c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start' c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start_thread' c:/ruby/lib/ruby/1.8/webrick/server.rb:94:in `start' c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `each' c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `start' c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start' c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start' c:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:57:in `dispatch' This error occured while loading the following files: interior_selection.rb Request Parameters: None Show session dump <http://127.0.0.1:3000/InteriorSelections#> --- flash: !ruby/hash:ActionController::Flash::FlashHash {} Response Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} -----Original Message----- From: Steve Downey [mailto:sldowney@berkeley.edu] Sent: Fri 8/12/2005 12:11 PM To: rails@lists.rubyonrails.org Cc: Subject: Re: [Rails] RE: Another newbie one.... Ron DiFrango wrote: >Further tests with the same result: > >class InteriorSelection < ActiveRecord::Base > def self.table_name() > "interior_selections" > end > > def self.primary_key() > "selection_id" > end >end > > rather than overriding the table_name() and primary_key() methods try: class InteriorSelection < ActiveRecord::Base set_table_name "interior_selections" set_primary_key "selection_id" end see: http://ar.rubyonrails.com/classes/ActiveRecord/Base.html#M000277 _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Zachery Hostens
2005-Aug-12 20:04 UTC
Re: RE: Another newbie one....Primary Kye and table overloading
try including the model using the model directive in your controller. Im pretty sure it should look like model :interior_selections the error *looks* like its trying to use InteriorSelections but it hasent been loaded yet. (usually not a problem in rails 0.13.1 i dont think) On 8/12/05, Ron DiFrango <rdifrango-wfttzDtloRfhmZgEOWDAxUEOCMrvLtNR@public.gmane.org> wrote:> Did that and got the the following: > > Code: > > class InteriorSelections < ActiveRecord::Base > set_table_name "interior_selections" > set_primary_key "selection_id" > end > > > NameError in Interior_selections#index > > uninitialized constant InteriorSelection > script/server:49 > Show framework trace <http://127.0.0.1:3000/InteriorSelections#> > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/dependencies.rb:186:in `const_missing'' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/core_ext/string/../../inflector.rb:59:in `const_get'' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/core_ext/string/../../inflector.rb:59:in `constantize'' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/core_ext/string/../../inflector.rb:58:in `inject'' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/core_ext/string/../../inflector.rb:58:in `each'' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/core_ext/string/../../inflector.rb:58:in `inject'' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/core_ext/string/../../inflector.rb:58:in `constantize'' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/core_ext/string/inflections.rb:44:in `constantize'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/pagination.rb:169:in `paginator_and_collection_for'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/pagination.rb:111:in `paginate'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/scaffolding.rb:101:in `list'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/scaffolding.rb:94:in `index'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:in `send'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:in `perform_action_without_filters'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:295:in `perform_action_without_benchmark'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in `perform_action_without_rescue'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in `measure'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in `perform_action_without_rescue'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/rescue.rb:80:in `perform_action'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in `send'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in `process'' > c:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb:32:in `dispatch'' > c:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:105:in `handle_dispatch'' > c:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:71:in `service'' > c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' > c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' > c:/ruby/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'' > c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start'' > c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'' > c:/ruby/lib/ruby/1.8/webrick/server.rb:94:in `start'' > c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `each'' > c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `start'' > c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' > c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' > c:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:57:in `dispatch'' > This error occured while loading the following files: > interior_selection.rb > > > > > Request > > > Parameters: None > > Show session dump <http://127.0.0.1:3000/InteriorSelections#> > > --- > flash: !ruby/hash:ActionController::Flash::FlashHash {} > > Response > > Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} > > > -----Original Message----- > From: Steve Downey [mailto:sldowney-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org] > Sent: Fri 8/12/2005 12:11 PM > To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Cc: > Subject: Re: [Rails] RE: Another newbie one.... > > > > Ron DiFrango wrote: > > >Further tests with the same result: > > > >class InteriorSelection < ActiveRecord::Base > > def self.table_name() > > "interior_selections" > > end > > > > def self.primary_key() > > "selection_id" > > end > >end > > > > > > rather than overriding the table_name() and primary_key() methods try: > > class InteriorSelection < ActiveRecord::Base > set_table_name "interior_selections" > set_primary_key "selection_id" > end > > see: http://ar.rubyonrails.com/classes/ActiveRecord/Base.html#M000277 > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- Zachery Hostens <zacheryph-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Michael Koziarski
2005-Aug-12 23:11 UTC
Re: RE: Another newbie one....Primary Kye and table overloading
> class InteriorSelections < ActiveRecord::Base > set_table_name "interior_selections" > set_primary_key "selection_id" > end> uninitialized constant InteriorSelectionInteriorSelections != InteriorSelection That''s all it was. -- Cheers Koz