Questions tagged [after-save]

68 questions
1
vote
2 answers

Endless looping with an aftersave subroutine

I am trying to maintain the security of my workbook using veryhidden to force users to enable macros. This works great except that users have complained about the lack of a dialog box to ask if they wish to save or not on close. I have added the…
1
vote
1 answer

Yii2 how to resave the modal in afterSave

I have a model ProductOffer inside of it I use afterSave to generate the coupon. Right now the status is null and in aftersave I want to update it. public function afterSave($insert, $changedAttributes) { if (floatval($this->offer) >=…
Aljay
  • 456
  • 7
  • 21
1
vote
1 answer

How can I do a global Model afterSave() on Cake?

How can I do a global Model afterSave() on Cake? I want to do some things right after a save is done. Thanks, Gino
steamboy
  • 1,162
  • 5
  • 20
  • 37
1
vote
3 answers

How to passing parameter to afterSave() Method in yii2?

I'm new to yii2. I want to write afterSave() method after insert new record. My scenario is: when the user add a damage must be send email to him. When user add damage, does not enter the serial number. I should read his name and serial damage but…
ParisaN
  • 1,816
  • 2
  • 23
  • 55
1
vote
2 answers

CakePHP 3 - Use saved data inside afterSave()

I have submitted a form in my view which will be processed in the controller. What normally happens is that the controller saves the edits by doing this: if ($this->Requests->save($request)) { // the request have been saved. } Now I created…
S. Kerdel
  • 90
  • 1
  • 9
1
vote
1 answer

how to get the parse user from the afterSave function

How do I get the parse user in the afterSave function ? Parse.Cloud.afterSave(Parse.User, function(request) { Parse.Cloud.useMasterKey(); console.log("username: "+request.user.username); query = new Parse.Query(Parse.User); …
user379468
  • 3,989
  • 10
  • 50
  • 68
1
vote
2 answers

using Parse.Could.AfterSave on adding a relation to a ParseObject

i'm just experiencing parse sdk and i wanted to use cloud code to increment a Number column whenever a relationship between two tables added by client(for example user likes a post) , in parse documentation there is just codes for incrementing a…
1
vote
1 answer

Difference between before_save and after_save using real time entities

I want to know the exact difference between before_save and after_save. Now, I have read the documentation and I know the difference as per their name. But, I want to know the exact difference using real time entities. It would be great if you…
santa banta
  • 313
  • 1
  • 2
  • 17
1
vote
0 answers

Rails: Strategy for keeping track of highest score per level

I'm working on a Rails app that needs to keep track of a user's highest score for each level that they play. Each attempt on a level has multiple rounds, the sum of scores for each round in the attempt is cached as total_score in the…
jessecurry
  • 22,068
  • 8
  • 52
  • 44
1
vote
1 answer

Rails after_save error

Is this the correct way of using after_save callback ? class CouponsController < ApplicationController after_save :remove_restrictions private def remove_restrictions logger.debug("in after save") end end This code throws the error…
Ajey
  • 7,924
  • 12
  • 62
  • 86
1
vote
1 answer

Saving dynamic values to another table/model using foreach in afterSave Yii

this is the my first post and I'm really confused with the below code. I'm building a gaming website (my first project using yii) and I'm using afterSave() in the model to insert data to another table because the relation is Many to Many. I'm…
Ahmad Dajani
  • 23
  • 1
  • 5
1
vote
2 answers

Getting previous HABTM values

In my app, I have several clients, and they have several elements (via has_many_through association) depending on a certain BusinessType to which Client belongs to so that instead of manually adding all the elements to the Client, I can just select…
1
vote
1 answer

Either get the id, either the bin, from after_post_process or after_save

I've been fighting this for some time now, and your help will certainly be of much appreciation. I've built a method to sign pdf documents which you can find here, and now am only one step away from signing my file. I would like to do this…
MrWater
  • 1,797
  • 4
  • 20
  • 47
1
vote
2 answers

Rails 3 - modifying an attribute of other model after model.save

Unfortunately I'm probably still too much a Rails beginner, so, even though I thought about and tried different approaches, I didn't get to work what I want and now have to ask for help again. I have a REST comment vote mechanism with thumbs up…
rails_has_elegance
  • 1,590
  • 4
  • 21
  • 37
1
vote
2 answers

Rails 3: cancel insert on after_save

I have a model that, when a record is inserted, needs to call a webservice. If the webservice fails ( timeout or other failures ), them the save in database should also be reverted. I used the after_save callback and tried to raise an…
Fernando
  • 4,459
  • 4
  • 26
  • 39