Commit 18e247d0 authored by Joshua Verdey's avatar Joshua Verdey

:wq

"midt
parent 7ce2c630
class CarLogsController < ApplicationController class CarLogsController < ApplicationController
def index
@car_logs = CarLog.all
end
def show
@car_log = CarLog.find(params[:id])
end
def new
@car_log = CarLog.new
end
def create
@car_log = CarLog.new(car_log_params)
if @car_log.save
redirect_to @car_log, notice: "User was successfully added!"
else
end
end
end end
class PagesController < ApplicationController class PagesController < ApplicationController
def index
@car_logs = CarLog.all
end
def show
@car_log = CarLog.find(params[:id])
end
def new
@car_log = CarLog.new
end
def create
@car_log = CarLog.new(car_log_params)
if @car_log.save
redirect_to @car_log, notice: "User was successfully added!"
else
end
end
end end
<ul class="nav nav-pills">
<li role="presentation" class="active"><a href="/pages">Home</a></li>
</ul>
<h1>Car Logs</h1> <h1>Car Logs</h1>
<table border="1"> <table>
<thead> <thead>
<th>Plate Number: </th>
<th>Brand: </th>
<th>Slot Number: </th>
<th>Is Taken: </th>
<th>Created: </th>
<th>Updated: </th>
</thead>
<tbody>
<% @car_logs.each do |car_log| %>
<tr> <tr>
<td>Plate Number</td> <td><%= car_log.plate_number %></td>
<td>Brand</td> <td><%= car_log.brand %></td>
<td>Slot Number</td> <td><%= car_log.slot_number %></td>
<td>Is Taken</td> <td><%= car_log.is_take %></td>
<td><%= car_log.created_at %></td>
<td><%= car_log.updated_at %></td>
</tr> </tr>
</thead> <%end %>
</tbody>
</table> </table>
<a href="../">Back</a>
\ No newline at end of file
<h1>Make a new user</h1>
<select name ="brand">
<option value="A">A</option>
<option value="A">A</option>
<option value="A">A</option>
</select>
<a href="../">Back</a>
\ No newline at end of file
<h1>Hey</h1> <h1>Welcome to the Parking Lot</h1>
<p>
<a href="car_logs#index">Car Logs</a> <ul class="nav nav-pills">
<a href="pages#create">Create</a> <li role="presentation" class="active"><a href="car_logs#index">Car Logs</a></li>
\ No newline at end of file <li role="presentation" class="active"><a href="/pages/new">Create</a></li>
</ul>
</p>
<ul class="nav nav-pills">
<li role="presentation" class="active"><a href="/pages">Home</a></li>
</ul>
<h1>New Car</h1>
<%= form_for(@car_log) do |c| %>
<p>
<%= c.label :plate_number %>
<%= c.text_field :plate_number %>
</p>
<p>
<%= c.label :brand %>
<select name ="brand">
<option value="Honda">Honda</option>
<option value="Toyota">Toyota</option>
<option value="Ford">Ford</option>
</select>
</p>
<p>
<%= c.label :slot_number %>
<%= c.text_field :slot_number %>
</p>
<p>
<%= c.label :is_taken %>
<%= c.password_field :password %>
</p>
<%= c.submit %>
<% end %>
\ No newline at end of file
Rails.application.routes.draw do Rails.application.routes.draw do
root 'pages#index'
get '/pages', to: 'pages#index', as: :car_logs
get 'pages' => 'pages#create' get '/pages/new', to: 'pages#new', as: :new_car_log
get 'car_logs' => 'car_logs#index' get 'car_logs' => 'car_logs#index'
post '/pages', to: 'pages#create"', as: :car_log
# The priority is based upon order of creation: first created -> highest priority. # The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes". # 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