-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyCollection.txt
More file actions
127 lines (105 loc) · 2.76 KB
/
Copy pathMyCollection.txt
File metadata and controls
127 lines (105 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
Create My Collections System Rails Application:
rails MCS
Create Asset Management System Controllers:
ruby script/generate controller Administrator
ruby script/generate controller User
ruby script/generate controller Brand
ruby script/generate controller Category
Create Asset Management System Models:
ruby script/generate model Administrator
ruby script/generate model User
ruby script/generate model Brand
ruby script/generate model Category
Create Asset Management System Views:
ruby script/generate view Administrator
ruby script/generate view User
ruby script/generate view Brand
ruby script/generate view Category
Database for Asset Management System:
CREATE DATABASE MCS_development
CREATE DATABASE MCS_test
CREATE DATABASE MCS_production
config/database.yml:
development:
adapter: mysql
database: MCS_development
host: localhost
username:
password:
test:
adapter: mysql
database: MCS_test
host: localhost
username:
password:
production:
adapter: mysql
database: MCS_production
host: localhost
username:
password:
Create Tables For The Database:
ruby script/generate migrate Administrator
ruby script/generate migrate User
ruby script/generate migrate Brand
ruby script/generate migrate Category
db/001_Administrator.rb:
class Administrator < ActiveRecord::Migration
def self.up
create_table :administrators do |table|
table.column :administrator_name, :string
table.column :username, :string
table.column :password, :string
table.column :email, :string
end
end
def self.down
drop_table :administrators
end
end
db/002_Category.rb:
class Category < ActiveRecord::Migration
def self.up
create_table :categories do |table|
table.column :category_name, :string
table.column :description, :text
end
end
def self.down
drop_table :categories
end
end
db/003_User.rb:
class User < ActiveRecord::Migration
def self.up
create_table :users do |table|
table.column :username, :string
table.column :password, :string
table.column :firstname, :string
table.column :lastname, :string
table.column :address01, :string
table.column :address02, :string
table.column :country, :string
table.column :email, :string
table.column :contact01, :string
table.column :contact02, :string
end
end
def self.down
drop_table :users
end
end
db/004_Department.rb:
class Brand < ActiveRecord::Migration
def self.up
create_table :brands do |table|
table.column :brand_name, :string
table.column :description, :text
end
end
def self.down
drop_table :brands
end
end
Create Tables:
rake migrate::db