lib/has_states/state.rb in stateful_models-0.0.1 vs lib/has_states/state.rb in stateful_models-0.0.2

- old
+ new

@@ -1,41 +1,6 @@ # frozen_string_literal: true module HasStates - class State < ActiveRecord::Base - self.table_name = 'has_states_states' - - belongs_to :stateable, polymorphic: true - - validate :status_is_configured - validate :state_type_is_configured - - after_save :trigger_callbacks, if: :saved_change_to_status? - - private - - def status_is_configured - return if HasStates.configuration.valid_status?( - stateable_type.constantize, - state_type, - status - ) - - errors.add(:status, 'is not configured') - end - - def state_type_is_configured - return if HasStates.configuration.valid_state_type?( - stateable_type.constantize, - state_type - ) - - errors.add(:state_type, 'is not configured') - end - - def trigger_callbacks - HasStates.configuration.matching_callbacks(self).each do |callback| - callback.call(self) - end - end + class State < Base end end