Skip to content

Instantly share code, notes, and snippets.

@bhgames
Created July 13, 2010 19:18
Show Gist options
  • Save bhgames/474351 to your computer and use it in GitHub Desktop.
Save bhgames/474351 to your computer and use it in GitHub Desktop.
subscrpt.current_delivery_address = curraddr
subscrpt.subscrpt_type = SubscrptType.find(:first, :conditions => {:id => i.subscrpt_type_id})
subscrpt.subscrpt_terms = SubscrptTerms.find(:first, :conditions => {:id => i.subscrpt_terms_id})
subscrpt.save
@user.subscrpts<<subscrpt
Mysql::Error: Column 'current_delivery_address_id' cannot be null: INSERT INTO `subscrpt` (`current_delivery_address_id`, `processed`, `processed_by_provider`, `provider_id`, `subscrpt_status`, `subscrpt_terms_id`, `subscrpt_type_id`, `user_id`) VALUES (NULL, 0, 0, NULL, NULL, NULL, NULL, NULL)
class Subscrpt < ActiveRecord::Base
set_table_name "subscrpt"
set_primary_key "id"
has_one :current_delivery_address, :class_name => 'Address', :primary_key => :current_delivery_address_id
has_one :subscrpt_type
has_one :subscrpt_terms
has_one :provider
has_one :user
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment