rails - after_update occurring on .save for new object

Viewed 8489

I have two models: UserNotification and Schedule. When a schedule is created, one type of user notification is created (the first line of code). When a schedule is updated, another type of user notification is created (the second line of code). For some reason, after_update is occurring after a save (i only want it to happen after an update). Here is code in code:

class Schedule < ActiveRecord::Base
   after_save 'UserNotification.schedule_created(@user)'
   after_update 'UserNotification.schedule_updated(@user)'
end

Am I missing something. How do I get after_save to only happen after I say @schedule.save and after_update to only occur after I do @schedule.update_attributes(...) ? Here is the controller code if it helps:

if @schedule.save   
    flash[:notice] = "Successfully created schedule."
    redirect_to profile_path(current_user.profile_name)  #change to project path later
end
1 Answers
Related