Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion StateMachine without AR Integration on an AR Model
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Aaron Pfeifer  
View profile  
 More options Mar 6 2012, 10:21 pm
From: Aaron Pfeifer <aaron.pfei...@gmail.com>
Date: Tue, 6 Mar 2012 19:21:08 -0800 (PST)
Local: Tues, Mar 6 2012 10:21 pm
Subject: Re: StateMachine without AR Integration on an AR Model

Hey Rainer -

Great question!  What you found is pretty much exactly what I would have
recommended.  I don't *think* you actually need the :use_transactions option
-- you should just be able to override the action (as you've done) and call
it a day.

The one alternative is that you can completely turn off all of the
ActiveRecord features or explicitly force state_machine to treat the
integration like an ActiveModel integration which will avoid creating
things like named scopes.  For example:

state_machine :form_step, :initial => :field_type_step, :integration =>
:active_model do
  ...
end

Hope this helps and best of luck!

Best,
Aaron

On Friday, March 2, 2012 10:22:19 AM UTC-5, Rainer Kuhn wrote:

> I think I might have found a way.

> After reading through StateMachine::Integrations::ActiveRecord I
> puzzled this together. Seems to pass the first few specs so far.

> state_machine :form_step, :initial
> => :field_type_step, :use_transactions => false, :action => nil do

> http://rdoc.info/github/pluginaweek/state_machine/master/frames

> Rainer

> On Mar 2, 12:00 pm, Rainer Kuhn <rai...@incutio.com> wrote:
> > Hi Guys,

> > I really enjoy state_machine so far. I'm currently creating a
> > multistep form as seen in Railscast 217
> http://railscasts.com/episodes/217-multistep-forms

> > Ryan Bates creates a whole bunch of instance methods that should
> > rather be handled by a state machine. But it's state should not be
> > saved in the database, since it's just handling new forms.

> > Is it possible to include a state machine on my model that does not
> > try to save the state automatically and just uses an instance variable
> > on the unsaved record?

> > Rainer


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.