I have two models: UserNotification and Schedule. When a schedule is created, one type of user notification is created (first line of code). When the schedule is updated, another type of user notification is created (second line of code). For some reason, after_update happens after saving (I want this to happen after the update). Here is the code in the code:
class Schedule < ActiveRecord::Base
after_save 'UserNotification.schedule_created(@user)'
after_update 'UserNotification.schedule_updated(@user)'
end
I'm missing something. How to get after_save only after I say @ schedule.save and after_update so that they appear only after I did @ 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)
end