From 0bd43e538af45fd36c1bc969a6b11ced40b18b01 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Fri, 9 Oct 2015 16:26:39 +0200 Subject: [PATCH] add current_user_dossier function at UserController --- app/controllers/users_controller.rb | 6 ++++++ spec/controllers/users_controller_spec.rb | 0 2 files changed, 6 insertions(+) create mode 100644 spec/controllers/users_controller_spec.rb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 32cb47327..0d2a1ca20 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,3 +1,9 @@ class UsersController < ApplicationController before_action :authenticate_user! + + def current_user_dossier dossier_id=nil + dossier_id ||= params[:dossier_id] + + current_user.dossiers.find(dossier_id) + end end \ No newline at end of file diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb new file mode 100644 index 000000000..e69de29bb