module Workflow::Join::ActiveRecord
Constants
- ENSURE_COLUMNS
Public Class Methods
included(base)
click to toggle source
# File lib/workflow/join/active_record.rb, line 21 def self.included(base) base.singleton_class.send :define_method, :prepended do |model| fail LoadError, "This module might be included in ActiveRecord::Base instances only (#{base} given.)" \ unless model < ::ActiveRecord::Base # unless ENSURE_COLUMNS.call(model, :workflow_pending_transitions, :workflow_pending_callbacks) # fail LoadError, <<-MSG # ======================================================================================= # This is an intended fail, next time the class is requested, it’ll be loaded properly! # To avoid this one should explicitly specify columns: # — workflow_pending_transitions, # — workflow_pending_callbacks # in all models, that are willing to use joined workflows. # ======================================================================================= # MSG # end end end