diff --git a/app/models/contact.rb b/app/models/contact.rb new file mode 100644 index 0000000..8649734 --- /dev/null +++ b/app/models/contact.rb @@ -0,0 +1,4 @@ +class Contact < ActiveRecord::Base + has_many :mails + has_many :phones +end diff --git a/app/models/mail.rb b/app/models/mail.rb new file mode 100644 index 0000000..b8767fd --- /dev/null +++ b/app/models/mail.rb @@ -0,0 +1,3 @@ +class Mail < ActiveRecord::Base + belongs_to :contact +end diff --git a/app/models/phone.rb b/app/models/phone.rb new file mode 100644 index 0000000..e7f1641 --- /dev/null +++ b/app/models/phone.rb @@ -0,0 +1,3 @@ +class Phone < ActiveRecord::Base + belongs_to :contact +end diff --git a/db/migrate/20110502213910_create_contacts.rb b/db/migrate/20110502213910_create_contacts.rb deleted file mode 100644 index 1f562bf..0000000 --- a/db/migrate/20110502213910_create_contacts.rb +++ /dev/null @@ -1,7 +0,0 @@ -class CreateContacts < ActiveRecord::Migration - def self.up - end - - def self.down - end -end diff --git a/db/migrate/20110502221401_create_mails_for_contacts.rb b/db/migrate/20110502221401_create_mails_for_contacts.rb deleted file mode 100644 index b4951de..0000000 --- a/db/migrate/20110502221401_create_mails_for_contacts.rb +++ /dev/null @@ -1,7 +0,0 @@ -class CreateMailsForContacts < ActiveRecord::Migration - def self.up - end - - def self.down - end -end diff --git a/db/migrate/20110502221705_create_phones_for_contacts.rb b/db/migrate/20110502221705_create_phones_for_contacts.rb deleted file mode 100644 index 284efb1..0000000 --- a/db/migrate/20110502221705_create_phones_for_contacts.rb +++ /dev/null @@ -1,7 +0,0 @@ -class CreatePhonesForContacts < ActiveRecord::Migration - def self.up - end - - def self.down - end -end diff --git a/db/migrate/20110504201530_create_contacts.rb b/db/migrate/20110504201530_create_contacts.rb new file mode 100644 index 0000000..3f623c4 --- /dev/null +++ b/db/migrate/20110504201530_create_contacts.rb @@ -0,0 +1,19 @@ +class CreateContacts < ActiveRecord::Migration + def self.up + create_table :contacts do |t| + t.string :firstname + t.string :lastname + t.string :street + t.string :housenr + t.string :plz + t.string :place + t.string :country + + t.timestamps + end + end + + def self.down + drop_table :contacts + end +end diff --git a/db/migrate/20110504201805_create_mails.rb b/db/migrate/20110504201805_create_mails.rb new file mode 100644 index 0000000..cf7d6b2 --- /dev/null +++ b/db/migrate/20110504201805_create_mails.rb @@ -0,0 +1,14 @@ +class CreateMails < ActiveRecord::Migration + def self.up + create_table :mails do |t| + t.string :desc + t.string :address + + t.timestamps + end + end + + def self.down + drop_table :mails + end +end diff --git a/db/migrate/20110504202804_create_phones.rb b/db/migrate/20110504202804_create_phones.rb new file mode 100644 index 0000000..b4fc037 --- /dev/null +++ b/db/migrate/20110504202804_create_phones.rb @@ -0,0 +1,14 @@ +class CreatePhones < ActiveRecord::Migration + def self.up + create_table :phones do |t| + t.string :desc + t.string :nr + + t.timestamps + end + end + + def self.down + drop_table :phones + end +end diff --git a/db/schema.rb b/db/schema.rb index 6dadb54..1607e0b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,15 +1,41 @@ -# 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 => 20110502221705) do - -end +# 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 => 20110504202804) do + + create_table "contacts", :force => true do |t| + t.string "firstname" + t.string "lastname" + t.string "street" + t.string "housenr" + t.string "plz" + t.string "place" + t.string "country" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "mails", :force => true do |t| + t.string "desc" + t.string "address" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "phones", :force => true do |t| + t.string "desc" + t.string "nr" + t.datetime "created_at" + t.datetime "updated_at" + end + +end diff --git a/test/fixtures/contacts.yml b/test/fixtures/contacts.yml new file mode 100644 index 0000000..e81aa67 --- /dev/null +++ b/test/fixtures/contacts.yml @@ -0,0 +1,19 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html + +one: + firstname: MyString + lastname: MyString + street: MyString + housenr: MyString + plz: MyString + place: MyString + country: MyString + +two: + firstname: MyString + lastname: MyString + street: MyString + housenr: MyString + plz: MyString + place: MyString + country: MyString diff --git a/test/fixtures/mails.yml b/test/fixtures/mails.yml new file mode 100644 index 0000000..a7b15e8 --- /dev/null +++ b/test/fixtures/mails.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html + +one: + desc: MyString + address: MyString + +two: + desc: MyString + address: MyString diff --git a/test/fixtures/phones.yml b/test/fixtures/phones.yml new file mode 100644 index 0000000..a03bfee --- /dev/null +++ b/test/fixtures/phones.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html + +one: + desc: MyString + nr: MyString + +two: + desc: MyString + nr: MyString diff --git a/test/unit/contact_test.rb b/test/unit/contact_test.rb new file mode 100644 index 0000000..ee7d2ca --- /dev/null +++ b/test/unit/contact_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class ContactTest < ActiveSupport::TestCase + # Replace this with your real tests. + test "the truth" do + assert true + end +end diff --git a/test/unit/mail_test.rb b/test/unit/mail_test.rb new file mode 100644 index 0000000..06c2aff --- /dev/null +++ b/test/unit/mail_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class MailTest < ActiveSupport::TestCase + # Replace this with your real tests. + test "the truth" do + assert true + end +end diff --git a/test/unit/phone_test.rb b/test/unit/phone_test.rb new file mode 100644 index 0000000..5ef075b --- /dev/null +++ b/test/unit/phone_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class PhoneTest < ActiveSupport::TestCase + # Replace this with your real tests. + test "the truth" do + assert true + end +end