mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Lazy-require state machine internals when the module is included
This commit is contained in:
parent
d7bad6e2eb
commit
29a31912fc
3 changed files with 8 additions and 7 deletions
|
@ -1,14 +1,10 @@
|
|||
Dir[File.dirname(__FILE__) + "/state_machine/*.rb"].sort.each do |path|
|
||||
filename = File.basename(path)
|
||||
require "active_model/state_machine/#{filename}"
|
||||
end
|
||||
|
||||
module ActiveModel
|
||||
module StateMachine
|
||||
class InvalidTransition < Exception
|
||||
end
|
||||
|
||||
def self.included(base)
|
||||
require 'active_model/state_machine/machine'
|
||||
base.extend ClassMethods
|
||||
end
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
require 'active_model/state_machine/state_transition'
|
||||
|
||||
module ActiveModel
|
||||
module StateMachine
|
||||
class Event
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
require 'active_model/state_machine/state'
|
||||
require 'active_model/state_machine/event'
|
||||
|
||||
module ActiveModel
|
||||
module StateMachine
|
||||
class Machine
|
||||
|
|
Loading…
Reference in a new issue