Questions tagged [after-save]
68 questions
0
votes
2 answers
Ruby on Rails - Run after_save only if new records
In my application I have models Post & Image. My association are:
class Post < ActiveRecord::Base
has_many :images
accepts_nested_attributes_for :images, reject_if: :image_rejectable?, allow_destroy: true
class Image < ActiveRecord::Base
…

Rubioli
- 685
- 6
- 34
0
votes
0 answers
Rails after_commit / after_save hooks on same instance?
I am planning to use some transient attributes of a model which I set on initialization of an object, and then reading it in an after_save or after_commit callback.
The only issue I can foresee is, in a multiple server environment, if after_save is…

shiladitya
- 2,290
- 1
- 23
- 36
0
votes
2 answers
Using Promise in afterSave
I am trying to do the following code in cloud code:
//Code for sending push notifications after an update is created
Parse.Cloud.afterSave('AssignmentMod', function(request){
//Only send if the mod is new
console.log("MOD SAVED.…

steventnorris
- 5,656
- 23
- 93
- 174
0
votes
0 answers
Updating wrong User with devise after_create in user model
I have set up a referral_code, and want to add 1 to the user whose referral_code it is, after someone signs up. There are no errors with the code, but the referral_count only updates the first user, no matter what user number is put in as the…

gwalshington
- 1,418
- 2
- 30
- 60
0
votes
1 answer
Self hosted parse server after-save function
I've configured a self-hosted parse server and I need to use the after-save function. After much researching and testing, I got very confused and have some questions. What I need is to send an email from the parse server (not the app) when a given…

VeYroN
- 760
- 9
- 19
0
votes
1 answer
ruby on rails active record after_save not capturing the parent object
I am trying to use after_save call back on cartItems object to update the total cart price attribute in the cart object (parent of cartItems) . But I am getting the error
undefined method cart_items on nil class
I researched on google and the code…

Pawan Rawat
- 495
- 1
- 7
- 25
0
votes
2 answers
Parse Server - Cloud Code beforeSave and afterSave effect each other
In my parse-server cloud code, I have one beforeSave and one afterSave function. The beforeSave is a verification about "which user makes the saving" to the "post" table. The afterSave function upates an object in the "post" table when a comment is…

saner
- 821
- 2
- 10
- 32
0
votes
1 answer
Parse.com afterSave trigger for object with array of other objects
I need to analyse some data after it has been uploaded to Parse and saved but the data is an object that contains an array of other objects...
Parent
-------
children : [Child]
I'm just not certain if the afterSave will trigger before all the…

Fogmeister
- 76,236
- 42
- 207
- 306
0
votes
2 answers
afterSave member Parse Cloud Code not saving
I am attempting to save a username and userId after a user registers into a Runner Class within Parse. For some reason the information is not saving and I am not receiving an error. Can anyone give some advice?
Parse.Cloud.afterSave(Parse.User,…

Ace
- 603
- 2
- 15
- 33
0
votes
2 answers
request.object.id not returning in afterSave() in Cloud Code
Parse.Cloud.afterSave(function(request) {
var type = request.object.get("type");
switch (type) {
case 'inspiration':
var query = new Parse.Query("Inspiration");
break;
case 'event':
var query = new…

dahveed707
- 907
- 6
- 14
0
votes
1 answer
Parse.com after_save from Webhook produces invalid json
I'm seeing the following error in my Parse.com Error logs:
E2015-09-28T12:40:37.531Z]vWEB after_save triggered for MPPChatRoom for user gI8UxW2JNa:
Input: {"object":{"counter":0,"createdAt":"2015-09-18T12:35:28.195Z","description":"client at…

elprl
- 1,940
- 25
- 36
0
votes
1 answer
How can I reject the record which not passed condition on model
I have a Car model which i want to check and discard record before it's saved ,if it not pass the condition from method the code is look like this :
class Car < ActiveRecord::Base
after_save :wheel_not_zero
def wheel_not_zero
false if…

DrNutsu
- 475
- 2
- 10
- 21
0
votes
1 answer
Parse.com Cloud Code afterSave( ) Error: "Uncaught Tried to save an object with a pointer to a new, unsaved object."
Context
I am using Parse.com after my backend for a web application. The problem I am having relates to Cloud Code.
After a user completes their profile, I want to call an afterSave( ) function which updates a few fields in the dataset…

Jesse
- 447
- 2
- 8
- 18
0
votes
1 answer
What is the Symfony2 equivalent to CakePHP beforeSave() afterSave()?
I would like to save notifications after certain events in my Symfony2 app. I've created a Notification Entity but I'm not sure how I can trigger an aftersave event on some other Entity to create a new Notification record.
In CakePHP I would add…

mike
- 1,583
- 1
- 19
- 35
0
votes
1 answer
Parse afterSave function getting skipped over
so i have a messaging app using parse.com as my backend. When i send a message from the app it saves it on Parse.com to a class called "NewMessages". Then in my cloud code i have an afterSave function dedicated to this class so that when a new…

ian
- 1,002
- 2
- 12
- 29