I am interested in testing Rails with a database whose tables are not named according to Ruby standards.The tables do do not use PLURAL names, and they use underscores. For example, I have a table called bbc_customer that I would like to use. Any good sites which discuss how to customize in this way? thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
There''s always the ActiveRecord documentation at api.rubyonrails.com. There is a meta-function in ActiveRecord::Base named ''set_table_name'' that allows you to override the default table name. So in your case: class Customer < AR::Base set_table_name ''bbc_customer'' end However, if all of your tables start with bbc_, then you can add a line to your config.rb: ActiveRecord::Base.table_name_prefix = ''bbc_'' ActiveRecord::Base.pluralize_tables = false # May have to look this one up, I can''t remember As for a webpage that describes all of the AR config settings, I''m not able to find one. Your best bet is to just look into the active_record source, starting with active_record/base.rb. Jason On 9/18/06, hillscottc <scott289-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > I am interested in testing Rails with a database whose tables are not > named according to Ruby standards.The tables do do not use PLURAL > names, and they use underscores. > > For example, I have a table called bbc_customer that I would like to > use. > > Any good sites which discuss how to customize in this way? thanks! > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ah, it''s: ActiveRecord::Base.pluralize_table_names = false It is all in base.rb, all the class-level variables. Jason On 9/18/06, Jason Roelofs <jameskilton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > There''s always the ActiveRecord documentation at api.rubyonrails.com. > > There is a meta-function in ActiveRecord::Base named ''set_table_name'' that > allows you to override the default table name. So in your case: > > class Customer < AR::Base > set_table_name ''bbc_customer'' > end > > However, if all of your tables start with bbc_, then you can add a line to > your config.rb: > > ActiveRecord::Base.table_name_prefix = ''bbc_'' > ActiveRecord::Base.pluralize_tables = false # May have to look this one > up, I can''t remember > > As for a webpage that describes all of the AR config settings, I''m not > able to find one. Your best bet is to just look into the active_record > source, starting with active_record/base.rb. > > Jason > > On 9/18/06, hillscottc <scott289-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > I am interested in testing Rails with a database whose tables are not > > named according to Ruby standards.The tables do do not use PLURAL > > names, and they use underscores. > > > > For example, I have a table called bbc_customer that I would like to > > use. > > > > Any good sites which discuss how to customize in this way? thanks! > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
That was just what I needed. Thanks for your help. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---