Commit cf2850f3 authored by Christiana Tan's avatar Christiana Tan

Updated

parent 7764570d
......@@ -17,7 +17,7 @@ gem 'coffee-rails', '~> 4.1.0'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
gem 'turbolinks', '~> 2.5.3'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
......
......@@ -133,7 +133,7 @@ GEM
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
turbolinks (1.2.0)
turbolinks (2.5.3)
coffee-rails
tzinfo (1.2.2)
thread_safe (~> 0.1)
......@@ -160,7 +160,7 @@ DEPENDENCIES
sdoc (~> 0.4.0)
spring
sqlite3
turbolinks
turbolinks (~> 2.5.3)
uglifier (>= 1.3.0)
web-console (~> 2.0)
......
......@@ -12,7 +12,7 @@ class CarLogsController < ApplicationController
@carlog = CarLog.find(params[:id])
@carlog.destroy()
redirect_to #something
redirect_to carlogs_path
end
def new
......@@ -21,12 +21,17 @@ class CarLogsController < ApplicationController
end
def create
@carlog = CarLog.new(carlog_params)
@carlog = CarLog.new
@carlog.plate_number = params[:plate_number]
@carlog.brand = params[:brand]
@carlog.slot_number = params[:slot_number]
@carlog.is_taken = params[:is_taken]
if @carlog.save
redirect_to show_carlog_path(@carlog)
redirect_to carlogs_path, notice: "Car Record was successfully added"
else
render 'new'
end
end
......
......@@ -7,6 +7,8 @@
<th> Brand </th>
<th> Slot Number </th>
<th> Created At </th>
<th> Is Taken ?</th>
<th> Delete</th>
</thead>
<tbody>
......@@ -16,7 +18,9 @@
<td><%=car.plate_number %> </td>
<td><%=car.brand%> </td>
<td><%=car.slot_number%> </td>
<td><%=car.create_at%> </td>
<td><%=car.created_at%> </td>
<td><%= car.is_taken%> </td>
<td><%= link_to "Delete", carlog_destroy_path(car.id) %></td>
</tr>
<% end%>
......
<h1> New Car Record</h1>
<%= form_tag "/carlogs/create" do%>
<form>
<%= form_tag '/carlogs/create' do %>
<!--ID <br/>
<input type: "text" name = "ID"><br> -->
Plate Number <br/>
<input type: "text" name = "Plate Number"><br>
<input type= "text" name = "plate_number"><br>
Brand
<select name = "brand">
<option value = "honda">Honda</option>
......@@ -19,12 +19,12 @@
</select> <br>
Slot Number <br/>
<input type: "text" name = "Slot Number"><br>
<input type= "text" name = "slot_number"><br>
Is Taken <br>
<input type="checkbox" name="is_taken"><br>
</form>
<%=submit_tag "Submit" %>
<%= submit_tag "Submit" %>
<%end%>
......@@ -4,9 +4,9 @@ Rails.application.routes.draw do
get '/carlogs/new', to: 'car_logs#new', as: :new_carlog
get '/carlogs/:id', to: 'car_logs#show', as: :show_carlog
get '/carlogs/:id', to: 'car_logs#destroy', as: :carlog_destroy
get '/carlogs', to: 'car_logs#create', as: :carlog
post '/carlogs/create', to: 'car_logs#create', as: :carlog
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment