mirror of https://github.com/fspc/BikeShed-1.git
Jason Denney
12 years ago
3 changed files with 45 additions and 1 deletions
@ -0,0 +1,10 @@ |
|||||
|
class Customer < ActiveRecord::Base |
||||
|
attr_accessible :first_name, :last_name, :addrStreet1, |
||||
|
:addrStreet2, :addrCity, :addrState, :addrZip, :phone, :email |
||||
|
|
||||
|
has_many :transactions |
||||
|
|
||||
|
def to_s |
||||
|
"#{first_name} #{last_name}" |
||||
|
end |
||||
|
end |
@ -0,0 +1,19 @@ |
|||||
|
class CreateCustomers < ActiveRecord::Migration |
||||
|
def change |
||||
|
create_table :customers do |t| |
||||
|
t.string "first_name", :null => false |
||||
|
t.string "last_name", :null => false |
||||
|
t.string "addrStreet1" |
||||
|
t.string "addrStreet2" |
||||
|
t.string "addrCity" |
||||
|
t.string "addrState" |
||||
|
t.string "addrZip" |
||||
|
t.string "phone" |
||||
|
t.string "email" |
||||
|
end |
||||
|
|
||||
|
add_index :customers, :phone, :unique => true |
||||
|
add_index :customers, :email, :unique => true |
||||
|
end |
||||
|
|
||||
|
end |
Loading…
Reference in new issue