Rails technoweenie / restful-authentication magi-code: Cannot find `User # register!`

I recently installed the technoweenie / restful-authentication plugin (which works as promised), but going through users_controller#created , I found a link to the method call in the user model

  @user.register! 

Does anyone know where this method is defined? I searched quite a lot of all the generated code and still do not see the registration method.

+4
source share
2 answers

It is defined in restful-authentication / lib / authorization / stateful_roles.rb mode

  event :register do transitions :from => :passive, :to => :pending, :guard => Proc.new {|u| !(u.crypted_password.blank? && u.password.blank?) } end 

The actual register! method register! It is created dynamically from this event by the act_as_state_machine plugin, which should also be in your project. This method was inserted into your controller, because when you generated your controller, you specified either --stateful or '--aasm'.

There is a very good entry on act_as_state_machine here if you want to know more.

+5
source

Launch Standby Generators

0
source

All Articles