state-machines / state_machines Goto Github PK
View Code? Open in Web Editor NEWAdds support for creating state machines for attributes on any Ruby class
Home Page: https://github.com/state-machines/state_machines
License: MIT License
Adds support for creating state machines for attributes on any Ruby class
Home Page: https://github.com/state-machines/state_machines
License: MIT License
I am using datamapper as my ORM and have an after_transition method doing a save but getting this error:
NameError: undefined local variable or method `save_customer' for #<StateMachines::Machine:0x007f889dc07da8>
Any help would be great.
Sorry if this is in the wrong place.
I have the following state machine and I'm trying to send an email after the state changes:
state_machine :state, initial: :unapproved do
event :reject_it do
transition [:approved, :unapproved] => :rejected
PurchaseRequestsMailer.purchase_request_rejected(self).send
end
end
My problem is that self refers to the statemachine object, not the object that is calling the state machine, is there anyway to access that object that's calling the state machine?
My setup:
class Vehicle
state_machine :state do
state :parked, value: 0
end
end
My goal is to turn :parked back into 0, for example:
Vehicle.state_value(:parked) # => 0
Can't find a method for it in the docs or some minor code inspection.... any ideas? Thanks!
In the readme I saw that state_paths
was a method defined on a model instance. Does the readme need some cleanup or am I doing something wrong?
Currently, arguments passed to an event are not passed to the guard, only the model object. I'm wondering if there is a reasoning behind this (i.e. is it poor practice), or if this is something that I could PR?
For our subscription model, currently, we have two events start_trial
and start_active
. We just found out we need start_future_active
and the nomenclature was a dead giveaway that we instead need one start
event with not necessarily deterministic paths through the state machine.
I say not necessarily because there is one deterministic case where we want to start
but we want to force it to skip the trial (trial is the default start behavior). In looking at this, I've found that a guard cannot inspect the arguments passed to an event, and that seems like exactly what we need. For example:
subscription.start(true) # skip trial plain arg
event.rb
def fire(object, *args)
machine.reset(object)
if transition = transition_for(object) # guards are checked here
transition.perform(*args) # args are passed here after guard check for execution
else
on_failure(object)
false
end
end
event :start_trial do
transition :uninitialized => :trial, if: :trial_enabled?
end
event :start_active do
transition [:uninitialized, :trial, :trial_expired, :system_grace, :grace] => :active
end
# now we need start_future - this needs to be refactored
This would appear to be simple to implement based on the code involved:
class Subscription
state_machine :state, initial: :uninitialized do
# plain arg example (proposal #1)
event :start do
transition :uninitialized => :trial, if: ->(subscription, args) { subscription.trial_enabled? && args.length > 0 && args[0] != true }
transition [:uninitialized, :trial, :trial_expired, :system_grace, :grace] => :active
transition :uninitialized => :future_active, if: future_dated?
end
end
end
This would require more significant changes, but still not too much. The transition would be initialized first then passed to the guard:
class Subscription
state_machine :state, initial: :uninitialized do
# transition example (proposal #2)
event :start do
transition :uninitialized => :trial, if: ->(subscription, transition) { subscription.trial_enabled? && transition.args[0] != true }
transition [:uninitialized, :trial, :trial_expired, :system_grace, :grace] => :active
transition :uninitialized => :future_active, if: future_dated?
end
end
end
@seuros - do you think this is a good addition? Is there an argument against allowing this?
/cc @bmcdaniel11
Is there something I can use that's similar to this?
I cannot seem to make it work with ActiveRecord. The initial state is never set correctly. I am using Ruby 2.1.x and Rails 4.2.x. Gem is 0.4.0
I have a Model that has a state field. State machine goes from pending, to starting to running to done
So pretty simple. But something is not working right (was working with 4.0 and the older version of state_machine (the one your forked from).)
So I am upgrading rails and finding that the old one is unmaintained and trying yours. But still not working properly for me
f = FeedCrawlingRun.new
=> #<FeedCrawlingRun:0x007fc7b4ebccf0
id: nil,
started_at: nil,
stopped_at: nil,
state: nil,
statistics: {},
downloaded_files: {},
feed_id: nil,
created_at: nil,
updated_at: nil>
Notice that state is nil . if I try to created it, it is never initialize correctly either
but if I do a f.starting? or f.pending? , it show the correct state. The state also shows with f.state.. But it is never saved to DB...
what am I missing?
When I'm trying to install this gem with OSX El Capitan I get this error:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/jankeesvw/.rbenv/versions/2.0.0-p645/bin/ruby extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... no
checking for rb_time_new()... yes
checking for sys/event.h... yes
checking for sys/queue.h... yes
creating Makefile
make "DESTDIR="
compiling binder.cpp
In file included from binder.cpp:20:
./project.h:107:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
^
1 error generated.
make: *** [binder.o] Error 1
Gem files will remain installed in /Users/jankeesvw/.rbenv/versions/2.0.0-p645/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3 for inspection.
Results logged to /Users/jankeesvw/.rbenv/versions/2.0.0-p645/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/ext/gem_make.out
An error occurred while installing eventmachine (1.0.3), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.0.3'` succeeds before bundling.
Is there a way to disable direct attribute assignment?
The aasm gem has something like this:
https://github.com/aasm/aasm/blob/ee147c60bc4ba356e0e8ce0ffa3f69d0476f8ce8/README.md#L797-L823
I think this concept could be argued either way so I am presenting it as a question than an issue. In this trivial example, the class has a method importance
. When using the state machine, I expected the importance
method to be overridden by the state machine when state == :on
, but that does not happen.
Should the state machine override the method when the state applies?
class MyModel
def importance
99
end
state_machine do
state :on do
def importance
1
end
end
state :off do
end
end
end
> m.state = :on
> m.importance
99 <---- expected to be 1, the state machine method is not being used
Thank you!
Afternoon Folks,
I have a machine defined which allows fairly broad transitions to/from various states as follows:
state_machine :state, initial: :draft do
# When the incident is being investigated by the team.
transition all => :under_investigation, :on => :under_investigation
# Transition back to an open state.
transition all => :open, :on => :open
# When the issue is resolved, but taking time to recover.
transition all => :in_recovery, :on => :in_recovery
#ย Transition to a closed state.
# Don't allow posting direct to closed, must be open first.
transition all - [:draft] => :closed, :on => :close
end
However, when calling state_paths()
on this object it just appears to hang or get caught in some form of an infinite loop. If I remove either :in_recovery
or :under_investigation
state/transition the problem appears to go away.
Any suggestions on what might be causing this? Am I doing something fundamentally wrong? Or is this a bug in the gem somewhere?
This seems to be the case running various 0.4.x
and 0.5.x
builds of state_machines. (May also be an issue further back)
Appreciate any insight.
Rob
before_transition to: [:shipped] do |order, transition|
order.ship_date = Time.now
end
after_transition to: [:shipped, :picked_up] do |order, transition ||vehicle, transition|
puts order.ship_date
order.update_inventory_status!
end
In this example, the ship_date
attribute of the order will be nil
in the after_transition callback.
Is ActiveRecord supported like in the 'state_machine' gem?
State does not seem to be persisted with a database field of 'state'...
Am I missing something?
I can't find the bang version of fire_state_event
(throw error instead of returning false). What is the best way to add this feature?
Guys, im tryng implement one dynamic state machive, but i dont kown where i making mistake.
im following this approach https://github.com/state-machines/state_machines#static--dynamic-definitions
but the state dont saved in DB.
I can retrieve state on the fly only using by console, but if i close terminal session and open another
session, the state always set :initial and DB Column is Nil
someone can help me?
im using Rails 4.2.4 and Ruby 2.1.1
Hi, I'm trying to migrate my app to use this gem now, I was using with_state
of the last gem, did you guys have removed this?
ex:
Coupon.with_state(:active)
Coupon.with_states(:active, :completed)
first issue is to show buttons for available events with the object. so, i solved it with code:
.actions
-@mission.state_paths(from: @mission.state, deep: false, guard: false).map{|a|a[0]}.uniq.map(&:event).map do |event|
-begin
=render "#{event.to_s}", mission: @mission, formats: [:html]
-rescue
=button event.to_s, '#', disabled: true
it works just fine until i add loops into events logic, for example, active mission can have event "take" which doesn't switch state, or some actions allow going back in actions. state_paths
returns thousands of variants and takes several seconds, which makes it unusable
is there any method to quickly calculate next possible event?
Can we make the state (string or integer) persistent to ActiveModel?
Thanks for bringing back life to this gem. state_machine was a major reason why we delayed upgrading to Rails 4.2 and with state_machines we have upgraded without any issues :)
The license and gemspec does include reference to the author of state_machine but I think it's fair that the original project https://github.com/pluginaweek/state_machine is attributed in the readme. Right now there is no way of telling that this project was originally forked from state_machine.
I can make a pull request but just wanted to open an issue for any input about this and also about the wording if the pull request is welcome. I think this pull request should also include some info about state_machines not only being a project that works with Rails 4 but also that it's a drop-in upgrade from state_machine. That's useful info for users who have found articles about state_machine but is unable to get it to work.
Again: thanks for your work. I'm sure there are many businesses depending on this gem, if the project is taking up a lot of your time I can suggest putting up some info on how businesses can help contribute to the development.
Hi,
It is possible to have multiple initial states? I'd like a statement machine to work like this:
unsubmitted -> pending_approval -> approved
with events submit and approve that move between these three states
But I'd also like to have a state called 'template'. For an object created with state template it should not be able to transition to any other state. I'd happy to explicitly state the desired initial state at creation.
I attempted something like this, but it didn't work:
state_machine :state, initial: [:unsubmitted, :template] do
event :submit do
transition :unsubmitted => :pending_approval
end
event :approve do
transition :pending_approval => :approved
end
Is this possible? I'd rather not do this, as I need to create a 'template' object atomically.
state_machine :state, initial: :unsubmitted do
event :submit do
transition :unsubmitted => :pending_approval
end
event :approve do
transition :pending_approval => :approved
end
event :make_template do
transition :unsubmitted => :template
end
end
Although, that said, perhaps the event only needs to exist to make the state machine aware of the state, and I can do this in ActiveRecord: MyObject.create!(state: :template, ...) and it's good enough.
state column was never saved.
Hi,
Thanks for this great project. I didn't know about it until a couple days ago.
I think many of your users will be transitioning here from the state_machine gem. Do you think you could add a couple lines to the readme explaining what the upgrade path is? Is it a seamless transition?
If you answer in this issue then I'll be happy to submit a PR.
Thanks!
I have a model with a conditional validation
validates :nda_accepted,
presence: true,
unless: :draft?
but if I try to transition it fails.
>> Rfq.last.valid?
=> true
>> Rfq.last.delete_draft!
StateMachines::InvalidTransition: Cannot transition state via :delete_draft from :draft (Reason(s): Nda accepted can't be blank)
from /Users/mmoen/code/UnderpantsGnome/britehub-app/vendor/bundle/ruby/2.2.0/gems/state_machines-0.4.0/lib/state_machines/event.rb:224:in `block in add_actions'
Hi,
Writing this issue because I use your gem and I have one small issue :
My state are constant, like that :
STATES = [ STATE_INTERNAL_DELIVERY = 'internal_delivery', STATE_DELIVERABLES_PENDING_REVIEW = 'deliverables_pending_review', STATE_FINISHING_STEP = 'finishing_step' ].freeze
and I'm trying to do a validation with :
state STATE_FINISHING_STEP, STATE_DELIVERABLES_PENDING_REVIEW, STATE_INTERNAL_DELIVERY do validate :validate_delivery_possible end
Which will run only on the last state.
But if I do this :
state 'deliverables_pending_review', 'internal_delivery', 'finishing_step' do validate :validate_delivery_possible end
It's running as expected.
Do you know why ?
I'm almost certain it is a bug.
Please tell me if I'm wrong. The initial state should be set, but it stays nil.
Here is a test for this:
I have the following defined:
before_transition ready_to_save: :screen_name_saved, do: :create_screen_name
I would expect that when create_screen_name raises an exception that the transitions would be halted.
I want to use this in a CLI workflow based App. I don't have any need for a database so I was hoping I can store the state in a file. Does this gem allow me to store the state in a file?
And how would I do so?
When defining a state machine, Machine#define_state_predicate
first checks to see whether the method it would add is already defined or not. However, when defining a state, State#add_predicate
does no such check.
We had a machine with a destroyed
check work fine until we started to upgrade to Rails 5.2, because that version of Rails adds a check for destroyed?
in its create_or_update
method.
Ideally, there would be a warning just like there is when defining a state already defined on another state machine on the same model.
edit: from this test case, it looks like this should already work?
Hi. I try to use state_machines for my project. Could you please explain, are there collection_helpers for forms and an integration with I18n?
Thank you.
The last official release is from 2015.
Since then, many changes have been applied.
v0.4.0...master
It would be great if you could cut a new release.
Hi!
How can I find which states can an event transition from without an instance of the underlying model?
I have this code working that uses the machine states
, their branches
and their state_requirements
values
, but it seems too involved and coupled to the library.
Thanks.
When writing tests for some after_transition callbacks I haven't seen exceptions being raised within the callback.
Example:
after_transition, :on => :finish, :do => :finish_it
def finish_it
foo
end
I'd expect a NameError
to be raised but the test continues execution. Is this intended behavior?
state_machine :state, initial: :uninitialized do
event :cancel do
transition [:trial, :active, :grace] => :canceled
end
after_transition on: :cancel, do: :process_cancel
end
def process_cancel(transition)
terminate = transition.args[0] || false
end
subscription.cancel!(true)
yields transition.args
emptysubscription.cancel!(true, 'foo')
yields transition.args
length 2 # [true, 'foo']
subscription.cancel!('foo')
yields transition.args
length 1 # ['foo']
This fired my method:
after_transition all => :paid, do: :process_payment
This did not:
after_transition on: :paid, do: :process_payment
Bug or am I misunderstand the :on
as a shortcut for all
?
Perhaps I am missing something here, but I cannot see any real reason why the :after_transition handler in this code is called twice in this very simple example:
class StateMachineActivity
state_machine :state, initial: :created do
after_transition to: :finished do |activity, transition|
puts "Finished."
end
event :next do
transition :created => :finished
end
end
end
In the console, test with
>> a = StateMachineActivity.new
#<StateMachineActivity:0x00000001300150 @state="created">
>> a.next
Finished.
Finished.
true
I would expect Finished to be printed only once. Inspecting the call stack shows callbacks for the after_transition are registered TWICE, but I cannot determine why or where.
Suggestions? Ideas?
I just switched over from pluginaweek's repo, and now all tests fail because state is returning nil.
state_machine :state, initial: :inactive do
before_transition any => :active, do: :archive_currently_active_adjustment
after_transition any => :active, do: :update_employee_current_salary!
event :activate do
transition any => :active
end
event :archive do
transition any => :historical
end
event :queue do
transition any => :pending
end
end
def initialize
super() # NOTE: This *must* be called, otherwise states won't get initialized
end
Here's a sample from the console:
SalaryAdjustment Load (13.1ms) SELECT "salary_adjustments".* FROM "salary_adjustments" WHERE "salary_adjustments"."deleted_at" IS NULL ORDER BY effective_date ASC LIMIT 1
=> #<SalaryAdjustment id: 48750, employee_id: 7304, scenario_id: nil, created_at: "2012-09-17 17:32:40", updated_at: "2012-09-21 15:29:08", memo: "6mo review", effective_date: "12-12-0001", position_title: "Teller", date_in_position: "08-18-2011", status: "inactive", new_wages: #<BigDecimal:7fea35ccbce0,'0.9E1',9(18)>, state: "historical", deleted_at: nil>
You can can that state is set to 'historical'. But...
2.2.2 :002 > SalaryAdjustment.last.state
SalaryAdjustment Load (9.8ms) SELECT "salary_adjustments".* FROM "salary_adjustments" WHERE "salary_adjustments"."deleted_at" IS NULL ORDER BY effective_date ASC LIMIT 1
=> nil
It appears that I cannot specify do:
on a transition definition such as
event :expire do
transition :active => :expired, do: :process_superceded, if: [:has_next?, :ended?]
transition :trial => :trial_expired, do: :process_trial_expiration, if: :ended?
transition :active => :grace, do: :process_grace, if: :within_grace_period?
transition [:active, :grace] => :expired, do: :process_expired, if: :exceeded_grace_period?
end
If that's the case, I'll have to copy a very similar block to create after_transition
s. This appears to be the only way:
event :expire do
transition :active => :expired, if: [:has_next?, :ended?]
transition :trial => :trial_expired, if: :ended?
transition :active => :grace, if: :within_grace_period?
transition [:active, :grace] => :expired, if: :exceeded_grace_period?
end
after_transition :active => :expired, do: :process_superceded
after_transition :trial => :trial_expired
after_transition :active => :grace, do: :process_grace
after_transition [:active, :grace] => :expired
This seems quite verbose and prone to error upon changes since I'm explicitly mirroring state transitions defined above. Am I correct in my understanding? Is there a reason not to allow do:
on the transition
?
Actually, there's a nuance that I can capture with the desired syntax, that I haven't with the second syntax: only run process_superceded
when [:has_next?, :ended?]
, so do I need to copy those conditions too? The unexpected behavior comes with the potential for :active => :expired
without meeting those conditions.
I had a previous state machine like the following
state_machine :state, :initial => :awaiting_quote, use_transactions: false do
event :submit_quote do
transition :awaiting_quote => :awaiting_quote_acceptance,
if: :line_item_details_complete?
end
event :accept_quote do
transition :awaiting_quote_acceptance => :awaiting_final_invoice
end
event :decline_quote do
transition :awaiting_quote_acceptance => :awaiting_quote
end
event :submit_final_invoice do
transition :awaiting_final_invoice => :awaiting_order_acceptance,
if: :attachment?
end
event :accept_order do
transition :awaiting_order_acceptance => :order_placed
end
end
as you can see 2 of the state changes are dependent on line_item_details_complete?
and attachment?
methods in my model
Now I am trying to implement the same state machine using dynamic state definitions
# Replace this with an external source (like a db)
def transitions
[
{ :awaiting_quote => :awaiting_quote_acceptance, :on => :submit_quote },
{ :awaiting_quote_acceptance => :awaiting_final_invoice, :on => :accept_quote },
{ :awaiting_quote_acceptance => :awaiting_quote, :on => :decline_quote },
{ :awaiting_final_invoice => :awaiting_order_acceptance, :on => :submit_final_invoice },
{ :awaiting_order_acceptance => :order_placed, :on => :accept_order }
# ...
]
end
# Create a state machine for this quotation instance dynamically based on the
# transitions defined from the source above
def machine
quotation = self
@machine ||= Machine.new(quotation, :initial => :awaiting_quote, :action => :save_state) do
quotation.transitions.each { |attrs| transition(attrs) }
end
end
# Save the state change
def save_state
self.save!
end
Now how do I use the same conditional state changes in this approach? Where should I add the if:
option? Thank you
Big tables will be happy with this!!
Can I assume that most of the DSL will allow arrays i.e.
after_transition on: :paid, do: [:process_payment, :notify_paid]
I don't see anything like that in the docs but it appears to be acceptable in the code.
Also, the readme references documentation
, other than code docs is there something else I can read to get a full understanding? Is there a better place to ask questions?
And...thanks for taking this over.
When I was working on transactions, I saw rescue Exception
in a lot of places. As far as I know, we don't have a need for it in state_machines (but I could be wrong). Perhaps we should consider switching to rescue => error
or just rescue
.
References:
on rails-4.2 with ruby-2.2.2, after installed the_teacher/the_comments, i have problem to submit comment due to server error 500 point on active_machine error.
here is the error:
"NoMethodError (protected method `around_validation' called for #StateMachine::Machine:0x0000000624a990):"
then after looking around this to fix, i see a patch find by this one (the_teacher), but would like to upgrade rails to something really works fine without patches things. Then i start to read some posts/issues around this. And try to install this gem.
I'm not sure to real understand what's happen due to big datas posted (i sink under all of these datas). So i don't know how to do to really use one of your fix for fix state_machine (i never find any clear instruction for do that... so i'm not an expert, for sure).
I would be very happy to read a pragmatic instructions article around "how to fix state-machine".
Or if this is an issue, to know how to find a nice solution.
Thanks for all.
I'm working on updating the state_machine_rspec gem to use state_machines and I've come across a critical difference in behaviour. In the old pluginaweek/state_machine the class method #state_machine returned a collection of state_machines, and the collection was inherited from Hash. In the state_machine_rspec gem there's a line which relies on [] to get a named machine from the collection. I can't find the equivalent method in the new state-machines/state_machines.
The difference is that in the new style the class method #state_machine returns a single state_machine and there doesn't seem to be a way to get one of possibly many named state machines.
This is blocking me from updating the state_machine_rspec gem (updated to state_machines_rspec gem) for the new state-machines/state_machine.
Any idea how I can solve this issue?
Consider this state machine configuration...
class MyClass
state_machine :state, initial: :pending do
state :pending, human_name: "To Do"
state :in_progress, human_name: "In Progress"
end
end
Attempting to fetch the human state name...
irb > MyClass.human_state_name :pending
=> "pending"
Other states work fine. The initial state is not being translated. Thanks.
Migrating from state_machine, I am missing the .with_state
option. Could it be included to this gem to make it more compatible?
Syntax:
Model.with_state([:new, :confirmed]
queries for objects WHERE state IN (?), ["new", "confirmed"]
Hello!
I use this gem along with the AR extension on a Rails app on Ruby 2.7. We override some of the transition methods for the state machine with kwargs, and we've started seeing the infamous Ruby 2.7 kwarg deprecation warnings when calling the unsafe versions of the transition methods.
# on the Car model with the state machine
def ignite(driver:)
update(driver: driver)
super()
end
Calling something like car.ignite!(driver: current_user)
from somewhere in the code will issue a warning:
/Users/julio/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/state_machines-0.5.0/lib/state_machines/event.rb:224: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/Users/julio/code/state_machine_test/app/models/car.rb:9: warning: The called method `ignite' is defined here
I've created this small Rails app with some test code that reproduces the issue: https://github.com/julitrows/state_machine_test
Doing some diggning, it seems to go down to the StateMachines::Event
class:
https://github.com/state-machines/state_machines/blob/master/lib/state_machines/event.rb#L224-L227
machine.define_helper(:instance, "#{qualified_name}!") do |machine, object, *args|
object.send(qualified_name, *args) || raise(StateMachines::InvalidTransition.new(object, machine, name))
end
It seems that object.send(qualified_name, *args)
should be sending object.send(qualified_name, **args)
in this particular case, but it probably would need to first detect what's *args (an array or a hash) before doing one or the other, to cover all cases.
NOTE I think this does not happen for the other helper definitions in that file.
I'm happy to send a PR to fix this, but I'm having trouble finding a test or tests in the gem codebase that would help reproduce the issue on the gem itself so I can start fixing.
Any help or pointers would be appreciated!
Thanks!
This occurs when trying to run specs in my rails engine gem where I use state_machines-activerecord, which uses state_machines. No ida why it happens?
Inspecting the output of the method like so:
# Whether the integration should be used for the given class.
def matches?(klass)
matching_ancestors.any? { |ancestor|
puts "#{klass.inspect} >< #{ancestor.inspect}"
klass <= ancestor
}
end
I get:
DataCollecting::CollectorRun (call 'DataCollecting::CollectorRun.connection' to establish a connection) >< "ActiveRecord::Base"
DataCollecting is one of the classes I use for state_machines
I have some ActveRecord based model like this:
class MyModel < ActiveRecord::Base
state_machine :status, initial: :initial do
event :order_purchased do
transition [:initial, :ordered] => :ordered
end
state :initial
state :ordered
end
end
I want to implicitly trigger the order_purchased event and update other attributes at the same time. When using state_machine this worked like so:
my_model.update_attributes status_event: :order_purchased, other_attribute: 'value'
With state_machines, however, I get an error:
ActiveRecord::UnknownAttributeError: unknown attribute: status_event
Also trying something like given in the README of state_machines (copied from state_machine) like the following:
my_model.status_event = 'order_purchased'
Does yield
NoMethodError: undefined method `status_event=' for #<MyModel:0x4c7a0338>
So I am using Virtus with State Machine and it seems with this approach state machine can not access the class.
Any thoughts?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.