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", ... ^ : INSERT INTO "prices" ("equity", "dat", "opn", "hgh", "low", "cls", "vol", "created_at", "updated_at", "id") VALUES ('sprint_common', '2010-01-04', 3.71, 3.92, 3.7, 3.9, 59299500, '2011-06-07 19:49:44', '2011-06-07 19:49:44', 1014512129) /home/ded/.rvm/gems/ruby-1.9.2-p180@rails303/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract_adapter.rb:202:in `rescue in log' ================================================
Here is what the fixtures look like: ==================== prices.yml ==================== p_01_04: equity: sprint_common dat: 2010-01-04 opn: 3.71 hgh: 3.92 low: 3.7 cls: 3.9 vol: 59299500 p_01_05: equity: sprint_common dat: 2010-01-05 opn: 3.92 hgh: 4.2 low: 3.9 cls: 4.13 vol: 95552600 ===================== equities.yml ============================= sprint_common: rawsym: s sym: S xch: NYSE issuer: sprint earliest: 2005-08-16 latest: 2010-12-31 ====================== issuers.yml ============================= sprint: cik: 10830 name: Sprint Nextel Corporation sic: 4813 stinc: KS fy_mo: 12 fy_day: 31 I've read the Fixtures document, which indicates that this ought to work. But I've also read that having a foreign key somehow keeps fixtures from loading. I have defined a foreign key constraint in one of my migrations from the prices to equities tables. Is it the foreign key that's causing the problem? If so, is there any work around without deleting the foreign keys? Thanks, -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/elpfUGllemh6V1VK. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.