In Postgres, I use different database schemas for each application, by declaring, e.g.: class ApplicationController < ActionController::Base ActiveRecord::Base.table_name_prefix = "keywords." end I assumed that the sequence names were also prefixed with the database schema names, e.g. keywords.things_id_seq But Rails 1.2.3 assumes the sequence is *NOT* in the same schema as the tables, and prefixes them with ''public.'' :-( I have to declare in *ALL* my classes: set_sequence_name "keywords.things_id_seq" This is awful in terms of maintenance. So I would be very grateful if I could find an equivalent of: ActiveRecord::Base.sequence_name_prefix = "keywords." (this fails: undefined method `sequence_name_prefix='' for ActiveRecord::Base:Class) Any help very much appreciated. Isabelle -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jun 19, 2007, at 4:13 , Isabelle Phan wrote:> In Postgres, I use different database schemas for each application, by > declaring, e.g.: > > class ApplicationController < ActionController::Base > ActiveRecord::Base.table_name_prefix = "keywords." > endRather than prefixing your table names with the schema name, add the schema you want to schema_search_path in your database.yml file. Your tables (and other database objects, such as sequences and indexes) will be created in that schema. For example, if you want your app to be located in the myapp schema: schema_search_path: myapp,public Be sure to include the public schema (after the myapp schema) as well. You might want to check the database and make sure the tables you''ve created so far are where you think they are. They might be named "keywords.foo" (in the public schema) rather than "keywords"."foo", which is how schema + table names are actually represented in Postgres. I haven''t checked how the PostgreSQL adapter quotes table and and column names, but it could be an issue. Michael Glaesemann grzm seespotcode net --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
many thanks Michael, that did it :-) I hadn''t thought of looking into ActiveRecord::ConnectionAdapters::PostgreSQLAdapter -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---