Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
parkinglot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AngKo_Catolico_Ilicito_Reyes
parkinglot
Commits
603358b5
Commit
603358b5
authored
Jul 05, 2016
by
Jego Reyes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added the delete function
parent
848989c6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
0 deletions
+11
-0
cars_controller.rb
parkinglot/app/controllers/cars_controller.rb
+8
-0
index.html.erb
parkinglot/app/views/cars/index.html.erb
+2
-0
routes.rb
parkinglot/config/routes.rb
+1
-0
No files found.
parkinglot/app/controllers/cars_controller.rb
View file @
603358b5
...
...
@@ -15,4 +15,12 @@ class CarsController < ApplicationController
redirect_to
(
"/cars"
)
end
def
delete
id
=
params
[
:id
]
@cars
=
CarLog
.
find
(
id
.
to_i
)
@cars
.
destroy
redirect_to
(
"/cars"
)
end
end
\ No newline at end of file
parkinglot/app/views/cars/index.html.erb
View file @
603358b5
...
...
@@ -31,6 +31,8 @@
<td
id=
"td2"
>
<%=
"
#{
car
.
created_at
}
"
%>
</td>
<td>
</td>
<td
id=
"td2"
>
<%=
"
#{
car
.
id
}
"
%>
</td>
<td>
</td>
<td
id=
"td2"
>
<a
href=
"cars/delete/
<%=
car
.
id
%>
"
>
Delete
</a>
</td>
</tr>
<%
end
%>
</table>
...
...
parkinglot/config/routes.rb
View file @
603358b5
...
...
@@ -5,4 +5,5 @@ Rails.application.routes.draw do
get
(
"/cars"
,
to:
"cars#index"
)
post
(
"/cars/create"
,
to:
"cars#create"
)
get
(
"/add"
,
to:
"cars#add"
)
get
(
"/cars/delete/:id"
,
to:
"cars#delete"
)
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment