CustomerVault
Install
First step is to add CustomerVault to Gemfile
:
gem "customer_vault"
and install it :
bundle install
Then, you need mount it in config/routes.rb
:
mount Dorsale::Engine, at: "/dorsale"
mount CustomerVault::Engine, at: "/customer_vault"
CustomerVault depends on Dorsale, so you need to mount it too.
After mount, you need to import and run CustomerVault (and it's dependencies) migrations :
rake railties:install:migrations
rake db:migrate
You have to perform this operation after each CustomerVault update to import eventual new migrations.
You now need to import JS and CSS files in app/assets/javascripts/application.js
:
//= require dorsale/all
//= require customer_vault/all
And in app/assets/stylesheets/application.sass
:
@import dorsale/all
@import customer_vault/all
Now, CustomerVault works but is not secure. CustomerVault has a permissive CustomerVault::Ability
class (CanCan gem) that does not control any access. You need to change the default Ability
to use :
Create this app/controllers/customer_vault/application_controller.rb
file :
require_dependency CustomerVault::Engine.root.join("app/controllers/customer_vault/application_controller.rb")
module CustomerVault
class ApplicationController
def current_ability
@current_ability ||= ::Ability.new(current_user)
end
end
end
And you just have to complete your existing Ability.rb
using CustomerVault Ability
as example.