Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Rails Engine for the GDPR compliance
GDPR Rails (also known as PolicyManager) is a Rails engine—a mountable Ruby gem originally built by the Prey team for preyproject.com—that adds GDPR compliance tooling to Rails applications: configurable consent policies, data portability exports, and script/cookie management.
GDPR Rails is a Rails engine that runs inside a host Rails application (Ruby 3.0+, Rails 6.1+, ActiveStorage required). It takes a set of policy rules you define in an initializer and generates consent workflows, management pages, and data export pipelines for end users. The engine provides both HTML views and JSON endpoints, so either server-rendered pages or client-side apps (React, Vue, etc.) can interact with the consent process.
cookie, age, or privacy_terms with options for validates_on, blocking, sessionless, if procs, and on_accept/on_reject callbacks.pending_user_terms, accept_user_term, and reject_user_term let frontend apps handle consent programmatically.current_user.has_consented_cookie?), and delete cookies when the user rejects.Install the gem, run rake policy_manager:install:migrations, mount PolicyManager::Engine at a path like /policies, include PolicyManager::Concerns::UserBehavior in your User model, and define rules and scripts in an initializer. The engine then exposes routes, helpers, and background jobs (ActiveJob) to handle the rest.
Add gem 'gdpr_rails' to your Gemfile, require policy_manager, run the migrations, mount the engine, and add the concern to your user model.
Yes. Include Devise::Controllers::Helpers into PolicyManager::UserTermsController to get current_user in the engine's controllers.
Ruby 3.0+, Rails 6.1+, and ActiveStorage configured in the host app. Paperclip is no longer supported.
