Is it possible to use the ActiveRecord Callbacks
- before_create
- after_create
- before_save
- after_save
- before_destroy
- after_destroy
to display notifications using jquery to the user?
Can someone provide an example??
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s not the responsibility of the model to comunicate back to the view. In my opinion this should be handled in the controller, not the model. The controller could look like:
The destroy and before create cases could follow the same idea: check manually in the controller and send the message from there.
Not exactly what you asked but I think you should keep them separated.