> ActiveRecord::Base.save on it. restful_authentication seems to be
> pretty much just generated templates and I cannot find any code that
> saves the record and there doesn't seem to be anything in
Actually restful_authentication is not simply a code generator when 
using acts_as_state_machine or aasm. It does actually call into code 
within the plugin to perform the state changes and update the database.

At least I think it's the case with acts_as_state_machine. The project I 
am currently working on is using aasm rather than the older 
act_as_state_machine.

In my case I have this line at the top of my User model along with a few 
other includes:
include Authorization::AasmRoles

So this is where all the state machine magic is happening.

Brian Cardarella wrote:
> I'm adding some code to a project using restful_authentication and
> acts_as_statemachine
> 

> In the create method for a user there is the following code generated
> by the restful_authentication template
> 
> @user.regster! if user.valid?
> 
> And this will save and the user record if it is valid. I understand
> that the statemachine will then change the state from passive to
> pending. It will guard against this by validating that the
> crypted_password and password getters are not blank. This I
> understand. I am not seeing anything in the code that actually does an
> ActiveRecord::Base.save on it. restful_authentication seems to be
> pretty much just generated templates and I cannot find any code that
> saves the record and there doesn't seem to be anything in
> acts_as_statemachine that recognizes this particular state change and
> saves the record. Perhaps I am missing something or maybe there is
> something else going on that saves the record. I don't see any type of
> observer running that will save the record upon a state change. I
> understand the purpose of state machines but for whatever reason I
> just cannot see how this plugin is saving the record. Any help would
> be appreciated.
> 
> - Brian Cardarella

-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to