Hey all, I am curious about how Rails interacts with SCHEMAs in PostgreSQL. From the generate command, is it possible to setup a scaffold for a table not in the public. schema in PostgreSQL? As a test, I tried, ./script/generate scaffold Manage.Form Manage.Form No dice. Any suggestions? -Robby -- /*************************************** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | robby-/Lcn8Y7Ot69QmPsQ1CNsNQ@public.gmane.org * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting & Development * --- Now hosting Ruby on Rails Apps --- ****************************************/
On Mon, 28 Feb 2005 17:00:46 -0800, Robby Russell <robby-/Lcn8Y7Ot69QmPsQ1CNsNQ@public.gmane.org> wrote:> Hey all, > > I am curious about how Rails interacts with SCHEMAs in PostgreSQL. From > the generate command, is it possible to setup a scaffold for a table not > in the public. schema in PostgreSQL? > > As a test, I tried, > ./script/generate scaffold Manage.Form Manage.FormHow about: class Form < ActiveRecord::Base table_name "Manage.Form" end ?> No dice. > > Any suggestions? > > -Robby > > -- > /*************************************** > * Robby Russell | Owner.Developer.Geek > * PLANET ARGON | www.planetargon.com > * Portland, OR | robby-/Lcn8Y7Ot69QmPsQ1CNsNQ@public.gmane.org > * 503.351.4730 | blog.planetargon.com > * PHP/PostgreSQL Hosting & Development > * --- Now hosting Ruby on Rails Apps --- > ****************************************/ > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Cheers Koz
On Tue, 2005-03-01 at 14:10 +1300, Michael Koziarski wrote:>On Mon, 28 Feb 2005 17:00:46 -0800, Robby Russell <robby-/Lcn8Y7Ot69QmPsQ1CNsNQ@public.gmane.org> wrote: >> Hey all, >> >> I am curious about how Rails interacts with SCHEMAs in PostgreSQL. From >> the generate command, is it possible to setup a scaffold for a table not >> in the public. schema in PostgreSQL? >> >> As a test, I tried, >> ./script/generate scaffold Manage.Form Manage.Form > >How about: > >class Form < ActiveRecord::Base > table_name "Manage.Form" >end >?Yes, I knew of that, just wondering if there was a way to define the table_name with the generate script..and if not, will there be a way? (feature request?) -Robby -- /*************************************** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | robby-/Lcn8Y7Ot69QmPsQ1CNsNQ@public.gmane.org * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting & Development * --- Now hosting Ruby on Rails Apps --- ****************************************/
On Mon, 28 Feb 2005 17:47:00 -0800, Robby Russell <robby-/Lcn8Y7Ot69QmPsQ1CNsNQ@public.gmane.org> wrote:> On Tue, 2005-03-01 at 14:10 +1300, Michael Koziarski wrote: > >On Mon, 28 Feb 2005 17:00:46 -0800, Robby Russell <robby-/Lcn8Y7Ot69QmPsQ1CNsNQ@public.gmane.org> wrote: > >> Hey all, > >> > >> I am curious about how Rails interacts with SCHEMAs in PostgreSQL. From > >> the generate command, is it possible to setup a scaffold for a table not > >> in the public. schema in PostgreSQL? > >> > >> As a test, I tried, > >> ./script/generate scaffold Manage.Form Manage.Form > > > >How about: > > > >class Form < ActiveRecord::Base > > table_name "Manage.Form" > >end > >? > > Yes, I knew of that, just wondering if there was a way to define the > table_name with the generate script..and if not, will there be a way? > (feature request?)It doesn''t appear like there''s a way to specify the table name in the model generator at present. You can file an enhancement request at http://dev.rubyonrails.org/. You could provide a patch too ..... ;)> -Robby > > -- > /*************************************** > * Robby Russell | Owner.Developer.Geek > * PLANET ARGON | www.planetargon.com > * Portland, OR | robby-/Lcn8Y7Ot69QmPsQ1CNsNQ@public.gmane.org > * 503.351.4730 | blog.planetargon.com > * PHP/PostgreSQL Hosting & Development > * --- Now hosting Ruby on Rails Apps --- > ****************************************/ > >-- Cheers Koz
>>>How about: >>> >>>class Form < ActiveRecord::Base >>> table_name "Manage.Form" >>>end >>>? >> >>Yes, I knew of that, just wondering if there was a way to define the >>table_name with the generate script..and if not, will there be a way? >>(feature request?)You can also use the table name prefix hooks that AR provides - but that will assume most of your tables are in a single schema (which is often the case). Then use the table_name stuff for exceptions. I believe you want to set the class variable "table_name_prefix" in ActiveRecord::Base to use this approach. Have a look through the docs. Regards, -- Dave Steinberg http://www.geekisp.com/ http://www.steinbergcomputing.com/