= Disclaimer A tool for adding disclaimers to applications. == Installation === Gemfile TODO - add config option === Routing Update config/routes.rb by adding: mount Disclaimer::Engine => "/disclaimer" See test/dummy/config/routes.rb == Usage First create a disclaimer document (see below) and give it a name. (The name is in underscore form: like_this). Then in your application controller, define the disclaimer you wish to use with 'disclaimer(:document_name)'. So for example, you have a disclaimer document with the name :our_company_disclaimer and you want to make sure that everyone who visits your products controller has accepted this disclaimer. Modify the controller like this: class ProductsController < ApplicationController disclaimer :our_company_disclaimer .....(rest of controller).... end Then when a user navigates to the products controller, they will be redirected to the disclaimer document at: /disclaimer/documents/our_company_disclaimer If they accept the disclaimer, they will be redirected back to the page they were originally aiming for. The acceptance is stored in session and therefore will be remembered for as long as the browser is open. === Options A before_filter is used to provide this functionality, and you can pass before_filter options through from the disclaimer declaration. Therefore, to only display a disclaimer for the index and show actions in a controller use: disclaimer :our_company_disclaimer, :only => [:index, :show] == Documents and Segments Documents can be created at /disclaimer/documents, and Segments as /disclaimer/segments. Documents can contain many segments, and segments can be shared across many documents (that is, you can share common sections of a disclaimer across many documents). This behaviour can be overwritten in the host application. The disclaimer engine does not restrict access to these controllers. Such restriction should be configured in the host application. However, everyone needs access to the disclaimer documents#show action so that they can read and accept the disclaimer.