2014-11-06 16:25:27 +01:00
|
|
|
class UsersController < ApplicationController
|
|
|
|
def show
|
2014-11-23 21:12:31 +01:00
|
|
|
@user = User.find(params[:id])
|
2014-11-09 22:53:39 +01:00
|
|
|
@orders = @user.orders.paginate(page: params[:page])
|
2014-11-06 16:25:27 +01:00
|
|
|
end
|
2014-11-06 18:30:53 +01:00
|
|
|
|
2014-11-23 21:12:31 +01:00
|
|
|
def index
|
|
|
|
@users = User.all
|
|
|
|
end
|
2014-12-09 22:32:54 +01:00
|
|
|
|
|
|
|
def destroy
|
|
|
|
User.find(params[:id]).destroy
|
|
|
|
flash[:success] = "Succesfully removed user"
|
|
|
|
redirect_to users_path
|
|
|
|
end
|
|
|
|
|
2014-12-10 14:18:56 +01:00
|
|
|
def dagschotel
|
|
|
|
user = User.find(params[:user_id])
|
|
|
|
user.dagschotel = Product.find(params[:product_id])
|
|
|
|
user.save
|
|
|
|
redirect_to edit_user_registration_path(user)
|
|
|
|
end
|
2014-11-06 16:25:27 +01:00
|
|
|
end
|