Hi, I'm writing this app with inheritance. I'm using the type column to store the class name. Another app scans the app and performs actions. However, it is possible that the second app does not implement a class, in which case, the superclass should be instantiated. Now I'm getting: /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/ active_record/base.rb:985:in `instantiate_without_callbacks': The single-table inheritance mechanism failed to locate the subclass: 'RMC'. 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 NmeaSentence.inheritance_column to use another column for that information. (ActiveRecord::SubclassNotFound) from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/ lib/active_record/callbacks.rb:215:in `instantiate' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/ lib/active_record/base.rb:390:in `find_by_sql' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/ lib/active_record/base.rb:390:in `find_by_sql' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/ lib/active_record/base.rb:924:in `find_every' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/ lib/active_record/base.rb:918:in `find_initial' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/ lib/active_record/base.rb:952:in `find_one' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/ lib/active_record/base.rb:941:in `find_from_ids' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/ lib/active_record/base.rb:382:in `find' from ./nmea_application.rb:66:in `update_state' from ./nmea_application.rb:45:in `insert_log' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/ lib/active_record/callbacks.rb:237:in `initialize' from ./nmea_application.rb:17:in `insert_log' from ./nmea_application.rb:58:in `loop' from ./nmea_application.rb:50:in `loop' from ./nmea_application.rb:14:in `start' from ./nmea_application.rb:75 so basically what I want to do is hook into active record and if it cannot find a class definition for a table, then the base superclass should be instantiated. How do I do that?
on 2006-05-11 20:12