mirror of
https://github.com/fspc/BikeShed-1.git
synced 2025-02-28 08:43:23 -05:00
Created customers
This commit is contained in:
parent
11e738b428
commit
d95f51eeca
10
app/models/customer.rb
Normal file
10
app/models/customer.rb
Normal file
@ -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
|
19
db/migrate/20130120142249_create_customers.rb
Normal file
19
db/migrate/20130120142249_create_customers.rb
Normal file
@ -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
|
17
db/schema.rb
17
db/schema.rb
@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20121229160809) do
|
||||
ActiveRecord::Schema.define(:version => 20130120142249) do
|
||||
|
||||
create_table "bike_actions", :force => true do |t|
|
||||
t.string "action", :limit => 128, :null => false
|
||||
@ -64,6 +64,21 @@ ActiveRecord::Schema.define(:version => 20121229160809) do
|
||||
|
||||
add_index "bikes", ["serial_number"], :name => "index_bikes_on_serial_number", :unique => true
|
||||
|
||||
create_table "customers", :force => true 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", ["email"], :name => "index_customers_on_email", :unique => true
|
||||
add_index "customers", ["phone"], :name => "index_customers_on_phone", :unique => true
|
||||
|
||||
create_table "logs", :force => true do |t|
|
||||
t.integer "loggable_id"
|
||||
t.string "loggable_type"
|
||||
|
Loading…
x
Reference in New Issue
Block a user