Handling instantiate_without_callbacks


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

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:ininstantiate’
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:infind_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:infind_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:infind_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:inupdate_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:ininitialize’
from ./nmea_application.rb:17:in insert_log' from ./nmea_application.rb:58:inloop’
from ./nmea_application.rb:50:in loop' from ./nmea_application.rb:14:instart’
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?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs