kben naar huis
This commit is contained in:
parent
d47e9af80c
commit
6b9e67ba2d
4 changed files with 10 additions and 1 deletions
|
@ -4,6 +4,7 @@ class ApplicationController < ActionController::Base
|
|||
protect_from_forgery with: :exception
|
||||
include SessionsHelper
|
||||
include ProductsHelper
|
||||
include OrdersHelper
|
||||
|
||||
private
|
||||
|
||||
|
|
|
@ -11,9 +11,11 @@ class OrdersController < ApplicationController
|
|||
|
||||
def show
|
||||
@user = User.find(params[:id])
|
||||
@order = selected_user.orders.build
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@order = current_user.orders.build(order_params)
|
||||
if @order.save
|
||||
#@flash[:success] = "Micropost created!"
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
module OrdersHelper
|
||||
|
||||
def selected_user
|
||||
@selected_user ||= User.find_by(id: @user.id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
<%= @user.name %>
|
||||
<%= @user.name %>
|
||||
|
||||
<%= render 'shared/order_form' %>
|
Loading…
Reference in a new issue