The currentuser-services gem lets you integrate your application with Currentuser.io very easily.
You can install the gem with the two following steps.
1. Add the gem in the Gemfile of your application:
# Gemfile gem 'currentuser-services'
Then don't forget to execute
2. Mount the Currentuser engine by calling 'currentuser' in your routes file:
# config/routes.rb MyApplication::Application.routes.draw do currentuser end
currentuser adds the following routes in your application:
# This always responds with HTTP status 200 GET /currentuser # This request signs a given user in GET /currentuser/sign_in # This request signs current user out DELETE /currentuser/sign_out
To configure the gem properly, you need to create an initializer in your application:
# config/initializers/currentuser.rb Currentuser::Services.configure do |config| # Replace 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' with your Project ID config.project_id = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' end
To obtain a Project ID, Sign up to Currentuser.io, create a new project and retrieve Project ID from the Currentuser.io settings.