I have a stock-related rails app, and I want to test the Price model. Each price object represents daily price
data for a single Equity, which in turn belongs to a single Issuer. I’ve run the test with the following fixtures and get this
error:
I have a stock-related rails app, and I want to test the Price model. Each price object represents daily price
data for a single Equity, which in turn belongs to a single Issuer. I’ve run the test with the following fixtures and get this
error:
I have a stock-related rails app, and I want to test the Price model. Each price object represents daily price data for a single Equity, which in turn belongs to a single Issuer. I've run the test with the following fixtures and get this error:
1\) Error:
test_the_truth(PriceTest): ActiveRecord::StatementInvalid: PGError: ERROR: column "equity" of relation "prices" does not exist LINE 1: INSERT INTO "prices" ("equity", "dat", "opn", "hgh", "low", ...
What do your has_many and belongs_to relationships look like in the models? What columns are present in the tables?
Colin
Colin,
======================== price.rb ===========================
class Price < ActiveRecord::Base
belongs_to :equities
…
end
========================equitiy.rb==========================
class Equity < ActiveRecord::Base
after_initialize :clean_up
after_update :clean_up
belongs_to :issuer
has_many :prices
…
end
=======================issuer.rb=============================
class Issuer < ActiveRecord::Base
after_initialize :clean_up
after_update :clean_up
validates_uniqueness_of :cik
has_many :filings
has_many :equities
has_many :former_names
…
end
That should be :equity, singular
Colin
Thanks, Colin. That did it. You 'da man.
Snow blindness strikes again.
Regards,