Permalink
Browse files

updated address

  • Loading branch information...
1 parent 2938054 commit bc737776859a872bb0836e237990ea6f90be4238 Caleb Brown committed Aug 28, 2010
View
@@ -16,6 +16,6 @@
class Address < ActiveRecord::Base
- has_one :company
+ belongs_to :addressable, :polymorphic => true
end
View
@@ -16,7 +16,7 @@ class Company < ActiveRecord::Base
attr_accessible :address, :name, :default_time_zone, :web_address
- belongs_to :address
+ has_one :address, :as => :addressable
has_many :projects, :dependent => :destroy
has_one :account
@@ -2,7 +2,6 @@ class CreateCompanies < ActiveRecord::Migration
def self.up
create_table :companies do |t|
- t.references :address
t.string :name, :null => false
t.string :default_time_zone, :default => 'Eastern Time (US & Canada)', :null => false
t.string :web_address
@@ -2,6 +2,7 @@ class CreateAddresses < ActiveRecord::Migration
def self.up
create_table :addresses do |t|
+ t.references :addressable, :polymorphic => true
t.string :street1
t.string :street2
t.string :city
View
@@ -1,153 +0,0 @@
-# This file is auto-generated from the current state of the database. Instead
-# of editing this file, please use the migrations feature of Active Record to
-# incrementally modify your database, and then regenerate this schema definition.
-#
-# Note that this schema.rb definition is the authoritative source for your
-# database schema. If you need to create the application database on another
-# system, you should be using db:schema:load, not running all the migrations
-# from scratch. The latter is a flawed and unsustainable approach (the more migrations
-# you'll amass, the slower it'll run and the greater likelihood for issues).
-#
-# It's strongly recommended to check this file into your version control system.
-
-ActiveRecord::Schema.define(:version => 20100822160641) do
-
- create_table "accounts", :force => true do |t|
- t.integer "company_id", :null => false
- t.integer "holder_id", :null => false
- t.string "subdomain"
- t.datetime "deleted_at"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "addresses", :force => true do |t|
- t.string "street1"
- t.string "street2"
- t.string "city"
- t.string "state"
- t.string "postal_code"
- t.string "country"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "categories", :force => true do |t|
- t.integer "default_assignee_id"
- t.integer "project_id", :null => false
- t.string "name", :null => false
- t.text "description"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "comments", :force => true do |t|
- t.boolean "deleted_at"
- t.integer "assignee_id"
- t.integer "commenter_id", :null => false
- t.integer "category_id"
- t.integer "issue_id", :null => false
- t.integer "milestone_id"
- t.integer "priority_id", :null => false
- t.integer "status_id", :null => false
- t.text "description", :null => false
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "companies", :force => true do |t|
- t.integer "address_id"
- t.string "name", :null => false
- t.string "default_time_zone", :default => "Eastern Time (US & Canada)", :null => false
- t.string "web_address"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "issues", :force => true do |t|
- t.boolean "is_private", :default => false
- t.integer "assignee_id", :null => false
- t.integer "opener_id", :null => false
- t.datetime "deleted_at"
- t.integer "category_id"
- t.integer "priority_id", :null => false
- t.integer "project_id", :null => false
- t.integer "status_id", :null => false
- t.integer "milestone_id"
- t.string "subject", :null => false
- t.string "token"
- t.text "description"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- add_index "issues", ["token"], :name => "index_issues_on_token", :unique => true
-
- create_table "milestones", :force => true do |t|
- t.datetime "due_date", :null => false
- t.integer "assignee_id"
- t.integer "opener_id", :null => false
- t.integer "project_id", :null => false
- t.string "name", :null => false
- t.text "description"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "projects", :force => true do |t|
- t.boolean "is_archived", :default => false
- t.boolean "is_private", :default => false
- t.integer "primary_company_id", :null => false
- t.integer "company_id", :null => false
- t.string "name", :null => false
- t.text "description"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "statuses", :force => true do |t|
- t.integer "default_assignee_id"
- t.integer "project_id", :null => false
- t.string "name", :null => false
- t.text "description"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "users", :force => true do |t|
- t.string "email", :default => "", :null => false
- t.string "encrypted_password", :limit => 128, :default => "", :null => false
- t.string "password_salt", :default => "", :null => false
- t.string "reset_password_token"
- t.string "remember_token"
- t.datetime "remember_created_at"
- t.integer "sign_in_count", :default => 0
- t.datetime "current_sign_in_at"
- t.datetime "last_sign_in_at"
- t.string "current_sign_in_ip"
- t.string "last_sign_in_ip"
- t.string "confirmation_token"
- t.datetime "confirmed_at"
- t.datetime "confirmation_sent_at"
- t.integer "failed_attempts", :default => 0
- t.string "unlock_token"
- t.datetime "locked_at"
- t.string "authentication_token"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.boolean "email_notifications", :default => true
- t.boolean "is_admin", :default => false
- t.datetime "deleted_at"
- t.integer "company_id"
- t.string "first_name", :null => false
- t.string "last_name", :null => false
- t.string "time_zone", :default => "Eastern Time (US & Canada)", :null => false
- t.string "web_address"
- end
-
- add_index "users", ["confirmation_token"], :name => "index_users_on_confirmation_token", :unique => true
- add_index "users", ["email"], :name => "index_users_on_email", :unique => true
- add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
- add_index "users", ["unlock_token"], :name => "index_users_on_unlock_token", :unique => true
-
-end

0 comments on commit bc73777

Please sign in to comment.