EDIT: This is with Rails 2.3.5
For some reason, when I try to associate a CreditCard with Band in my project, I get the following errors
SQLite3::SQLException: table credit_cards has no column named band: INSERT INTO "credit_cards" ("created_at", "vault_token", "billing_zipcode", "billing_first_name", "updated_at", "band", "billing_state", "billing_city", "id", "billing_email_address", "billing_country", "billing_address", "billing_phone_number", "billing_last_name") VALUES ('2010-10-08 03:26:07', 'vaulttokenvalue', 12345, 'Test', '2010-10-08 03:26:07', 'beekin', 'TX', 'AnyCity', 714867248, '[email protected]', 'US', '1234 Any Street', '5555555555', 'User')
and
SQLite3::SQLException: table bands has no column named credit_card: INSERT INTO "bands" ("name", "created_at", "next_payment_date", "updated_at", "credit_card", "account_type_id", "id", "hometown_city", "account_status", "subdomain", "hometown_state", "website", "account_type_name") VALUES ('Beekin', '2010-10-08 03:29:16', '2010-10-07', '2010-10-08 03:29:16', 'card_one', 715507355, 862144657, 'Nashville', 'ACTIVE', 'beekin', 'TN', 'http://www.beekin.com', 'MONTHLY')
My migration looks like
class CreateCreditCards < ActiveRecord::Migration
def self.up
create_table :credit_cards do |t|
t.references :band
t.string :billing_first_name
t.string :billing_last_name
t.string :billing_address
t.string :billing_city
t.string :billing_state
t.string :billing_zipcode
t.string :billing_country
t.string :billing_email_address
t.string :billing_phone_number
t.string :vault_token
t.timestamps
end
add_column :bands, :credit_card_id, :integer
end
end
My bands.yml fixture looks like:
beekin:
name: Beekin
website: "http://www.beekin.com"
hometown_city: Nashville
hometown_state: TN
subdomain: beekin
account_type: monthly
account_type_name: "MONTHLY"
account_status: "ACTIVE"
credit_card: card_one
next_payment_date: <%= Date.today %>
And my credit_cards.yml fixture looks like:
card_one:
band: beekin
billing_first_name: Test
billing_last_name: User
billing_address: "1234 Any Street"
billing_city: AnyCity
billing_state: TX
billing_zipcode: 12345
billing_country: US
billing_email_address: "[email protected]"
billing_phone_number: "5555555555"
vault_token: vaulttokenvalue
Can someone PLEASE point out what I'm doing wrong. I've compared it to other fixtures and it looks like it should work, but it's not.
Have the has_one :credit_card (in band model) and belongs_to :band (in credit_card model). I'm just really lost now.