Skip to content

Instantly share code, notes, and snippets.

@heycarsten
Created April 22, 2009 06:02
Show Gist options
  • Select an option

  • Save heycarsten/99618 to your computer and use it in GitHub Desktop.

Select an option

Save heycarsten/99618 to your computer and use it in GitHub Desktop.
# /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/relationship_chain.rb:49:in `initialize': undefined method `name' for nil:NilClass (NoMethodError)
# from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/one_to_many.rb:56:in `new'
# from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/one_to_many.rb:56:in `setup'
# from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations.rb:122:in `has'
class StoreProductInventory
include DataMapper::Resource
property :pid, Serial
property :store_no, Integer, :index => true
property :product_no, Integer, :index => true
property :quantity, Integer, :index => true
property :updated_on, Date, :index => true
belongs_to :store, :child_key => [:pno], :parent_key => [:store_no]
belongs_to :product, :child_key => [:pno], :parent_key => [:product_no]
end
class Store
include DataMapper::Resource
property :pno, Integer, :key => true
property :latitude, Float, :index => true
property :longitude, Float, :index => true
property :name, String
property :address_line_1, String
property :address_line_2, String
property :postal_code, String, :index => true
property :city, String, :index => true
property :telephone, String
property :fax, String
has n, :products, :through => :store_product_inventories,
:child_key => [:product_no],
:parent_key => [:pno]
end
class Product
include DataMapper::Resource
property :pno, Integer, :key => true
property :price_in_cents, Integer, :index => true
property :name, String
property :stock_type, String, :index => true
property :list_type, String, :index => true
property :primary_category, String, :index => true
property :secondary_category, String, :index => true
property :origin, String
property :package, String
property :alcohol_content, Float, :index => true
property :sugar_content, String, :index => true
property :producer_name, String
has n, :stores, :through => :store_product_inventories,
:child_key => [:store_no],
:parent_key => [:pno]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment