Paayos na lang. No delete and design pa.

parent 4ded60ed
class CarLogsController < ApplicationController class CarLogsController < ApplicationController
def index def index
#@car_logs = Car_Log.all @car_logs = Car_Log.all
render "car_logs/index.html.erb" render "car_logs/index.html.erb"
end end
...@@ -8,16 +9,16 @@ class CarLogsController < ApplicationController ...@@ -8,16 +9,16 @@ class CarLogsController < ApplicationController
render "car_logs/add_cars.html.erb" render "car_logs/add_cars.html.erb"
end end
#def create def create
# car_log = Car_Log.new car_log = Car_Log.new
# car_log.plate_number = params[:plate_number] car_log.plate_number = params[:plate_number]
# car_log.time_in = params[:time_in] car_log.time_in = params[:time_in]
# car_log.time_out = params[:time_out] car_log.time_out = params[:time_out]
# car_log.color = params[:color] car_log.color = params[:color]
# car_log.brand = params[:brand] car_log.brand = params[:brand]
# car_log.save car_log.save
# redirect_to "/car_logs/index" redirect_to "/car_logs"
#end end
end end
...@@ -17,5 +17,14 @@ ...@@ -17,5 +17,14 @@
<option value="black">black</option> <option value="black">black</option>
<option value="others">others</option> <option value="others">others</option>
</select> </select>
<label>Brand</label>
<select>
<option value="Honda">Honda</option>
<option value="Toyota">Toyota</option>
<option value="Ford">Ford</option>
</select>
<input type="submit" value="Save to Car Log"> <input type="submit" value="Save to Car Log">
<%end%> <%end%>
\ No newline at end of file
<h1>Car Records</h1> <h1>Car Records</h1>
<ul>
<% @car_logs.each do |car_log| %>
<li> <%= "#{car_log.plate_number} #{car_log.time_in} - #{car_log.time_out} #{car_log.color} #{car_log.brand}" %>
</li>
<%end%>
</ul>
<a href="/car_logs/add">Add Entry</a> <a href="/car_logs/add">Add Entry</a>
\ No newline at end of file
...@@ -3,4 +3,5 @@ Rails.application.routes.draw do ...@@ -3,4 +3,5 @@ Rails.application.routes.draw do
get "/pages", to: "pages#creators" get "/pages", to: "pages#creators"
get "/car_logs", to: "car_logs#index" get "/car_logs", to: "car_logs#index"
get "/car_logs/add", to: "car_logs#add" get "/car_logs/add", to: "car_logs#add"
post "/car_logs/create", to: "car_logs#create"
end end
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