Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
Venshop.v2
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vy Quoc Vu
Venshop.v2
Commits
0e984652
Commit
0e984652
authored
Jul 27, 2015
by
Vy Quoc Vu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update source
parent
dec4a28a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
+17
-2
app/controllers/carts_controller.rb
+14
-0
app/views/carts/info.html.erb
+1
-2
config/routes.rb
+2
-0
No files found.
app/controllers/carts_controller.rb
View file @
0e984652
...
...
@@ -3,7 +3,21 @@ class CartsController < ApplicationController
def
show
end
def
create
new_cart
=
Cart
.
new
(
cart_params
)
new_cart
.
save
byebug
end
def
info
@cart
=
Cart
.
new
end
def
user_params
params
.
require
(
:cart
).
permit
(
:name
,
:email
,
:address
)
end
def
cart_params
params
.
require
(
:session
).
permit
(
:name
,
:mail
,
:address
)
end
end
app/views/carts/info.html.erb
View file @
0e984652
...
...
@@ -17,7 +17,7 @@
</ul>
<div
class=
"row"
>
<div
class=
"col-md-10 "
>
<%=
form_for
(
:session
,
url:
cart_path
)
do
|
f
|
%>
<%=
form_for
(
:session
,
url:
c
reate_c
art_path
)
do
|
f
|
%>
<%=
f
.
label
:email
%>
<%=
f
.
email_field
:email
,
class:
'form-control'
%>
...
...
@@ -28,7 +28,6 @@
<%=
f
.
label
:address
%>
<%=
f
.
text_field
:address
,
class:
'form-control'
%>
</br>
<%=
f
.
submit
"Log in"
,
class:
"btn btn-primary"
%>
<%
end
%>
</div>
...
...
config/routes.rb
View file @
0e984652
...
...
@@ -9,6 +9,8 @@
get
'cart_products/:id'
=>
'cart_products#add'
get
'cart_products/clear'
=>
'cart_products#clear_cart_product'
get
'cart'
=>
'carts#info'
get
'carts'
=>
'carts#new'
post
'carts/create'
=>
'carts#create'
,
as:
'create_cart'
resources
:categories
,
only:
[
:index
,
:show
]
resources
:products
,
only:
[
:index
,
:show
]
...
...
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