Getting Started
- Policygen-rails
- Policygen-js
Customization
- Styling your policies
Configuration
- Configuring your policies
Installation
Add this line to your application's Gemfile:
gem 'policygen'
And then execute:
bundle install
Or install it yourself as:
gem install policygen
Run the installer
To setup the policygen config file in your rails project run:
rails generate policygen:install
If using Tailwind as your css framework
Add the following to app/config/tailwind.config.js:
module.exports = {
content: [
'./public/*.html',
...,
getPolicygenViewPath()
]
}
function getPolicygenViewPath() {
const { execSync } = require("child_process");
const path = execSync("bundle show policygen").toString().trim();
return `${path}/**/*.{erb,html,rb}`;
}
Usage
Policygen mounts two view helpers to render your policies into any view you want to setup. The contents are driven by the config defined in policygen.rb
Once you've answered all the config questions you're ready to render your privacy and terms page.
To render the privacy policy in your view use the following helper:
<div class="whatever-your-container-is">
<%= privacy_policy %>
</div>
To render the terms of service in your view use the following helper:
<div class="whatever-your-container-is">
<%= terms_of_service %>
</div>