Generate protocol number for new records, tickets, issues, documents, and everything you need to identify.
Add this line to your application's Gemfile:
gem 'protocolize'
Then install the dependencies:
bundle
Copy the migration to project:
rails g protocolize:install
Create the protocols table:
rake db:migrate
rspec spec
Include module to app/models/application_record.rb
:
class ApplicationRecord < ActiveRecord::Base
include Protocolize::ActsAsProtocolable
self.abstract_class = true
end
Set your model to act as protocolable associating with the protocol:
class MyModel < ApplicationRecord
acts_as_protocolable
end
That's it! Everytime the model configured to act as protocolable was created a protocol will be created together.
Gem Patterns How To Build A Ruby Gem With Bundler, Test-Driven Development, Travis CI And Coveralls, Oh My!