-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotes
More file actions
87 lines (47 loc) · 2.57 KB
/
notes
File metadata and controls
87 lines (47 loc) · 2.57 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
CONCERNS
1. After filling in a product my show page doesn't show products/id?
rails g resource Building name floor_num:integer
rails g resource Floor name floor_num:integer building:belongs_to
rails g resource Product name cateogory floor_num:integer in_stock:integer description:text date_added:datetime user:belongs_to floor:belongs_to
rails g resource User username email building:belongs_to
CHANGE COLUMN NAME IN EXISTING TABLE
1. rails g migration ChangeColumnNameFromCateogoryToCategory
2. rename_column :table_name, :old_column, :new_column
3. rails db:migrate
CREATING DATA FOR BUILDING IN THE BACK END IN MIGRATE/SEEDS.RB FILE.
CREATING DATA FOR BUILDING IN THE BACK END MANUALLY.
1. Rails C
2. Run Builing.all (To see if I have any data)
3. Building.create(name:"Fine Arts")
4. If Building ID is empty it's because I haven't saved it in my database. so I will have to review my create action in my building controller
ADD A REFERENCE COLUMN TO AN EXISTING TABLE
1. rails g migration AddBuildingIdToProducts building:references
REMOVE A COLUMN FROM A TABLE
1. rails generate migration remove_COLUMNNAME_from_TABLENAME COLUMNNAME:DATATYPE
rails generate migration remove_date_from_buildings date:date
rails generate migration remove_in_stock_from_Products in_stock:string
-
ADD A NEW COLUMN TO AN EXISTING TABLE
add new column to an existing table
1. generate a new migration - rails g migration add_building_id_to_products building_id:integer
2. manual add the change column inside the product table migration.
Concerns:
1. Ever users should be able to see building inventory of any building they selected to view inputs that was added from other users. They should also be able to makes edits.
Try. in my User create action add a redirect to the building/show new user selected.
2. would I need to add validates to my product model for no double cateogories?
clear and rests table
rake db:schema:dump
and then:
rake db:schema:load
-------------------------------------------------------------------
User flow
1.user creates account -> user show page -> create a link to
https://localhost:3000/auth/facebook/callback
https://0.0.0.0:3000/auth/facebook/callback
7/24/2019 commit - added omminautho, confirmed validation error messages"
-write a scope method referencing building name and alpha order
This will go into Building model
scope :ordered, -> { order('name desc') }
-create a new route that will render this data
get '/buildings/', to: 'buildings#index'
how to I render my scope methods? in my view