On Jul 28, 2009, at 11:58 AM, Craig White wrote: > > I have a problem with a table that has a field named 'type' > > When I try to use active record in a console, I get this error... > > ActiveRecord::SubclassNotFound: The single-table inheritance mechanism > failed to locate the subclass: '10'. This error is raised because the > column 'type' is reserved for storing the class in case of > inheritance. > Please rename this column if you didn't intend it to be used for > storing > the inheritance class or overwrite Debtortrans.inheritance_column to > use > another column for that information. > > Since I can't rename the column because the software creating it needs > this, is it possible to alias the name somehow within rails, perhaps > in > the model? > > Craig
The default value for the inheritance_column is "type" so you just need to change that to something else and then you should be able to use 'type' normally for your legacy data. class Debtortrans inheritance_column :not_used end (Assuming that there isn't a column named "not_used" in that table, of course. ;-) -Rob Rob Biedenharn http://agileconsultingllc.com [email protected] --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

