I have the following relationship
- User –> has_many: Articles
- Article –> belongs_to: User
I need to create a public (not restricted) page to Publish an Article (with Title & Description), in the same page I need to add the SignIn / SignUp form (with the possibility to switch bitween the SignIn and SignUp with ajax).
After click to the Publish “Button”, the behaviour is quite the same for SignIn and SignUp:
- SignUp, the Article will be inserted as “Draft”, and we will send an email to inform
- SignIn, the Article will be inserted as “Draft”, and we will send an email to complete the registration form
Which is the best approach?
Regards
See this thread:
How to add callback after registration with Rails3 and Devise
The key is, don’t look to Devise, use callbacks on your model(s) and Rails nested forms for sending the data.
Also note, the authentication layer for Devise is Warden, which does have callbacks for sign in/out.