Sha256: 03f3d6f4d9cb06fff499ca9ce267d5c721e6c83b68f66ee445f236965433afdf

Contents?: true

Size: 1.94 KB

Versions: 3

Compression:

Stored size: 1.94 KB

Contents

# frozen_string_literal: true

module Cmor
  module Audits
    module Routing
      module PaperTrailResourcesConcern
        extend ActiveSupport::Concern

        # Example:
        #
        #     # config/routes.rb
        #     Rails.application.routes.draw do
        #       resources :pages do
        #         paper_trail_resources
        #       end
        #     end
        #
        # This will give you:
        #
        #     $> rails routes
        #                             GET    /pages/:id/versions/:version_id(.:format)        cmor/cms/backend/pages#version
        #                             GET    /pages/:id/version_at(/:version_at)(.:format)    cmor/cms/backend/pages#version_at
        #               versions_page GET    /pages/:id/versions(.:format)                    cmor/cms/backend/pages#versions
        #                       pages GET    /pages(.:format)                                 cmor/cms/backend/pages#index
        #                             POST   /pages(.:format)                                 cmor/cms/backend/pages#create
        #                    new_page GET    /pages/new(.:format)                             cmor/cms/backend/pages#new
        #                   edit_page GET    /pages/:id/edit(.:format)                        cmor/cms/backend/pages#edit
        #                        page GET    /pages/:id(.:format)                             cmor/cms/backend/pages#show
        #                             PATCH  /pages/:id(.:format)                             cmor/cms/backend/pages#update
        #                             PUT    /pages/:id(.:format)                             cmor/cms/backend/pages#update
        #
        def paper_trail_resources
          get "versions/:version_id", on: :member, action: :version
          get "version_at(/:version_at)", on: :member, action: :version_at
          get "versions", on: :member, action: :versions
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cmor_audits-0.0.58.pre app/concerns/cmor/audits/routing/paper_trail_resources_concern.rb
cmor_audits-0.0.57.pre app/concerns/cmor/audits/routing/paper_trail_resources_concern.rb
cmor_audits-0.0.56.pre app/concerns/cmor/audits/routing/paper_trail_resources_concern.rb