Ron DiFrango
2005-Aug-12 20:31 UTC
RE: RE: Another newbie one....Primary Kye and tableoverloading
Okay, I got it now, but I am not sure why it worked. I changed the model name
to be just interior and put in the mappings I had before and it worked? Any one
have a guess as to why? Does Rails not deal well with multi-part names?
Here is my new code:
class InteriorSelectionsController < ApplicationController
scaffold :interior
end
class Interior < ActiveRecord::Base
set_table_name "interior_selections"
set_primary_key "selection_id"
end
-----Original Message-----
From: Zachery Hostens [mailto:zacheryph@gmail.com]
Sent: Fri 8/12/2005 4:04 PM
To: rails@lists.rubyonrails.org
Cc:
Subject: Re: [Rails] RE: Another newbie one....Primary Kye and tableoverloading
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@captechventures.com> 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@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@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>
--
Zachery Hostens <zacheryph@gmail.com>
_______________________________________________
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 22:08 UTC
Re: RE: Another newbie one....Primary Kye and tableoverloading
Im not sure about the multi-part name but your original scaffold line should have been scaffold :interior_selections and NOT scaffold :InteriorSelections On 8/12/05, Ron DiFrango <rdifrango-wfttzDtloRfhmZgEOWDAxUEOCMrvLtNR@public.gmane.org> wrote:> Okay, I got it now, but I am not sure why it worked. I changed the model name to be just interior and put in the mappings I had before and it worked? Any one have a guess as to why? Does Rails not deal well with multi-part names? > > Here is my new code: > > class InteriorSelectionsController < ApplicationController > scaffold :interior > end > > class Interior < ActiveRecord::Base > set_table_name "interior_selections" > set_primary_key "selection_id" > end > > > > -----Original Message----- > From: Zachery Hostens [mailto:zacheryph-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org] > Sent: Fri 8/12/2005 4:04 PM > To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Cc: > Subject: Re: [Rails] RE: Another newbie one....Primary Kye and tableoverloading > > > > 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> > _______________________________________________ > 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>