fix issue initial state doesn't work in active_record 4.2#335
Open
fly1tkg wants to merge 1 commit intopluginaweek:masterfrom
Open
fix issue initial state doesn't work in active_record 4.2#335fly1tkg wants to merge 1 commit intopluginaweek:masterfrom
fly1tkg wants to merge 1 commit intopluginaweek:masterfrom
Conversation
|
The initial state won't persist to the database. |
|
Hello guys how do i apply this fix to the state-machine gem |
|
Hey Destino92, if you you want to monkey patch it, you can create a file
with # Hacks around https://github.com/pluginaweek/state_machine/issues/334
module StateMachine
module Integrations
module ActiveRecord
def define_state_initializer
define_helper :instance, <<-end_eval, __FILE__, __LINE__ + 1
def initialize(*)
super do |*args|
self.class.state_machines.initialize_states self
yield(*args) if block_given?
end
end
end_eval
end
end
end
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is for #334 .