Sha256: 2879f815b08785f48dccabd81a98a57c8e111152e65a2f696d3b8a74f225ba7b
Contents?: true
Size: 723 Bytes
Versions: 2
Compression:
Stored size: 723 Bytes
Contents
module StateMachina module Integration def self.included(model) model.extend StateMachina::Definitions end def machine(machine_name = 'default') model_name = StateMachina::Util.normalized_klass_to_name(self.class) machine = StateMachina::Registry.find_machine!(model_name, machine_name) machine.model = self machine end alias_method :state_machine, :machine def machines model_name = StateMachina::Util.normalized_klass_to_name(self.class) machines = StateMachina::Registry.find_machines(model_name) machines.map do |machine| machine.model = self machine end end alias_method :state_machines, :machines end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
state_machina-0.1.1 | lib/state_machina/integration.rb |
state_machina-0.1.0 | lib/state_machina/integration.rb |