Skip to content

Commit

Permalink
Database changes (Bookings)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovy95 committed Feb 27, 2020
1 parent 3ea9cd4 commit b536336
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
5 changes: 5 additions & 0 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ class MakersBnB < Sinatra::Base
redirect ('/bookings')
end

post "/requests" do

end



run! if app_file == $0
end
4 changes: 2 additions & 2 deletions db/migrate/20200224210239_create_bookings.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
class CreateBookings < ActiveRecord::Migration[6.0]
def change
create_table :bookings do |t|
t.date :start_date
t.date :end_date
t.date :booking_date
t.references :users, foreign_key: true
t.references :spaces, foreign_key: true
t.boolean :confirmed
end
end
end
4 changes: 2 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
enable_extension "plpgsql"

create_table "bookings", force: :cascade do |t|
t.date "start_date"
t.date "end_date"
t.date "booking_date"
t.bigint "users_id"
t.bigint "spaces_id"
t.boolean "confirmed"
t.index ["spaces_id"], name: "index_bookings_on_spaces_id"
t.index ["users_id"], name: "index_bookings_on_users_id"
end
Expand Down
10 changes: 4 additions & 6 deletions views/bookings.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@
<h1>MakersBnB</h1>
<%= Space.find_by(id: session[:space_id]).name %>

<form action="/bookings" method="post" >
<form action="/requests" method="post" >

<label for="start_date">Start date:</label>
<input type="date" id="start_date" name="start date">
<label for="end_date">End date:</label>
<input type="date" id="end_date" name="end date">
<input type="submit" value="Submit">
<label for="booking_date">Booking date:</label>
<input type="date" name="booking_date">
<input type="submit" value="Submit Dates">
</form>
</br></br>
</body>
Expand Down

0 comments on commit b536336

Please sign in to comment.