Tanzanite Tanzanite
2007-Mar-28 04:33 UTC
overiding concatenation of tables by alphabetical order
Hi everyone! When doing a has_and_belongs_to_many join, with two tables, rails expects a join table whose name is the concatenation of the two table names in an alphabetical order. However i have a number of tables which do not follow this convection and wish to have rails read and recognize them. for example i have a table called feature and another called cvterm. The join table is however named feature_cvterm (rails would expect one called cvterm_feature) So it happily responds by generating an error that the table can''t be found or rather the class, i wish to have rails recognize the feature_cvterm join table. Which is the easiest way to do it? Please forgive my ignorance ( again the tribulations of working with a legacy database.) Thanks -- 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 -~----------~----~----~----~------~----~------~--~---
Michael Wang
2007-Mar-28 10:11 UTC
Re: overiding concatenation of tables by alphabetical order
Tanzanite Tanzanite wrote:> Hi everyone! > > When doing a has_and_belongs_to_many join, with two tables, rails > expects a join table whose name is the concatenation of the two table > names in an alphabetical order. > > However i have a number of tables which do not follow this convection > and wish to have rails read and recognize them. > > for example i have a table called feature and another called cvterm. The > join table is however named feature_cvterm (rails would expect one > called cvterm_feature) So it happily responds by generating an error > that the table can''t be found or rather the class, > > i wish to have rails recognize the feature_cvterm join table. > > Which is the easiest way to do it? > > Please forgive my ignorance > > ( again the tribulations of working with a legacy database.) > > Thanks >has_and_belongs_to_many :cvterm, :join_table => "feature_cvterm" -- Michael Wang --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Tanzanite Tanzanite
2007-Mar-28 18:05 UTC
Re: overiding concatenation of tables by alphabetical order
Michael Wang wrote:> Tanzanite Tanzanite wrote: >> join table is however named feature_cvterm (rails would expect one >> >> Thanks >> > > has_and_belongs_to_many :cvterm, :join_table => "feature_cvterm" > > > -- > Michael WangThanks Michael,-- i got it. -- 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 -~----------~----~----~----~------~----~------~--~---