Skip to content

Instantly share code, notes, and snippets.

@rknLA
Created March 30, 2012 00:44
Show Gist options
  • Save rknLA/2245366 to your computer and use it in GitHub Desktop.
Save rknLA/2245366 to your computer and use it in GitHub Desktop.
table naming
class CreateSellers < ActiveRecord::Migration
def change
create_table :sellers do |t|
t.integer :manager_id
t.integer :address_id
t.timestamps
end
end
end
# app/models/spree/seller.rb
module Spree
class Seller < ActiveRecord::Base
belongs_to :user, :foreign_key => 'manager_id'
belongs_to :address
has_many :orders
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment