foodsoft/app/models/shared_supplier.rb

36 lines
919 B
Ruby
Raw Normal View History

# == Schema Information
# Schema version: 20090102171850
#
# Table name: suppliers
#
# id :integer(4) not null, primary key
# name :string(255) not null
# address :string(255) not null
# phone :string(255) not null
# phone2 :string(255)
# fax :string(255)
# email :string(255)
# url :string(255)
# delivery_days :string(255)
# note :string(255)
# created_on :datetime
# updated_on :datetime
# lists :string(255)
#
2009-01-06 11:49:19 +01:00
class SharedSupplier < ActiveRecord::Base
# connect to database from sharedLists-Application
SharedSupplier.establish_connection(Foodsoft.config[:shared_lists])
2009-01-06 11:49:19 +01:00
# set correct table_name in external DB
set_table_name :suppliers
has_one :supplier
has_many :shared_articles, :foreign_key => :supplier_id
# save the lists as an array
serialize :lists
end