Maintaining state history

20 views
Skip to first unread message

Chris G

unread,
Mar 21, 2011, 7:20:05 PM3/21/11
to PluginAWeek: Talk
Hi all,

Is the state_machine_history gem the best way to maintain state
history?

Are there any other plugins / gems / techniques to look at?

Maybe even something to keep state history in the same table?

Thanks!

Chris

Aaron Pfeifer

unread,
Mar 21, 2011, 8:29:30 PM3/21/11
to PluginAWeek: Talk
Hey Chris -

state_machine_history is the closest thing that I'd expect of a
history tracker. There is also a library called state_machine_audits
at http://github.com/isotope11/state_machine_audits.

I don't know of any library that stores the history in the same table.

Best of luck,
Aaron

Chris G

unread,
Mar 22, 2011, 11:12:02 AM3/22/11
to PluginAWeek: Talk
I appreciate it, Aaron. Thanks for the plugin!

On Mar 21, 6:29 pm, Aaron Pfeifer <aaron.pfei...@gmail.com> wrote:
> Hey Chris -
>
> state_machine_history is the closest thing that I'd expect of a
> history tracker.  There is also a library called state_machine_audits
> athttp://github.com/isotope11/state_machine_audits.

Chris G

unread,
Mar 23, 2011, 7:11:44 PM3/23/11
to PluginAWeek: Talk
On the same topic, seems like state_machine_history broke with the
update to 0.10... if anyone knows how to get in touch with the authors

NoMethodError: undefined method `define_instance_method' for
#<StateMachine::Machine:0x108711188>
from /Users/cmg/.rvm/gems/ruby-1.8.7-p302@Claremont/gems/
state_machine_history-0.2.2/lib/state_machine_history.rb:32:in
`define_event_helpers'
from /Users/cmg/.rvm/gems/ruby-1.8.7-p302@Claremont/gems/
state_machine-0.10.1/lib/state_machine/machine.rb:1548:in
`define_helpers'

Jose Hales-Garcia

unread,
Mar 23, 2011, 7:38:22 PM3/23/11
to pluginaw...@googlegroups.com
It isn't difficult creating your own state machine history using a states table and a has_many association between the stateful model and the states model.

Care is needed in reading and writing, but I was able to do it by overriding the state and state= methods in my stateful model.  It works well.

If you want more details, I'll be happy to share more code.

Jose
.......................................................
Jose Hales-Garcia
UCLA Department of Statistics

Chris G

unread,
Mar 24, 2011, 12:04:29 PM3/24/11
to PluginAWeek: Talk
state_machine_history gem has been good, so far (barring the current
version breakage)

Thanks!

On Mar 23, 5:38 pm, Jose Hales-Garcia <jose.halesgar...@stat.ucla.edu>
wrote:
Reply all
Reply to author
Forward
0 new messages