Hello all, I'm about to bust an o-ring over here! Please help! For some reason single-table inheritance is getting triggered when I don't want it to. Here's the code: <code> class Site < ActiveRecord::Base def temporal_coverage .. end def project .. end end class ExampleSite < Site has_many :example_swath_observations end </code> There really isn't anything special going on here. I run a unit test involving ExampleSite.find(:all) and it is looking in "sites" for data! Same thing when I try from script/console. I DONT have a type column in "sites" but I though, maybe its looking for another column as well. So I set this in environment.rb: <code> ActiveRecord::Base.inheritance_column = "***_you_activerecord" </code> Everything works if I do a "set_table_name" but that's not really ideal. I'm not really sure where to go from here. Here's my schema if that helps: <code> # This file is autogenerated. Instead of editing this file, please use the # migrations feature of ActiveRecord to incrementally modify your database, and # then regenerate this schema definition. ActiveRecord::Schema.define(:version => 6) do create_table "example_sites", :force => true do |t| t.column "site_code", :string t.column "label", :string t.column "description", :string t.column "latitude", :float t.column "longitude", :float end create_table "example_swath_observations", :force => true do |t| t.column "date", :date t.column "site_id", :integer t.column "taxon_id", :integer t.column "mean_density", :float t.column "standard_error", :float end create_table "example_swath_taxa", :force => true do |t| t.column "genus", :string t.column "species", :string t.column "label", :string t.column "code", :string t.column "notes", :string t.column "sampling_warnings", :string end create_table "sites", :force => true do |t| t.column "bull", :string end end </code>
on 2007-03-29 00:25
on 2007-03-29 01:05
Ok I added: self.abstract_class = true to all the models I was subclassing and it worked. I was under the impression I didn't need to do this though.
on 2007-03-29 01:33
Yeah, this solution is less than ideal because then ExampleSite.kind_of?(Site) == false