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:
class Site < ActiveRecord::Base
def temporal_coverage
…
end
def project
…
end
end
class ExampleSite < Site
has_many :example_swath_observations
end
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:
ActiveRecord::Base.inheritance_column = "***_you_activerecord"
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:
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