diff options
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r-- | lib/api/helpers.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 783a91a..f76b039 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -5,7 +5,11 @@ module API end def authenticate_runner! - forbidden! unless Runner.find_by_token(params[:token]) + forbidden! unless current_runner + end + + def current_runner + @runner ||= Runner.find_by_token(params[:token]) end # Checks the occurrences of required attributes, each attribute must be present in the params hash |