I have a Problem with ActiveRecord. I´m using SQL-Queries in the
after_save-Callbacks which assert, that the change in the db already
took place. But this is not the case, because we´re still in the
As far as I know, there is no callback which is called AFTER a commit
although this i think this would be very attractive. What can I do
Here is the Problem:
I have the class Event, Resources and ResourceUses. Think of them as
lessons (Events) and Teachers and Rooms (Resources).
class Event < ActiveRecord::Base
has_many :resource_uses, :dependent => :destroy
has_many :resources, :through => :resource_uses
The Class “ResourceUse” has to check for Collisions based on the time-
data of the associated events. So in the after_save Callback, I run a
SQL-Query (in an instance-method of ResourceUse) to check for
Exactly: I have to do this for all ResourceUse-Instances which had
collisions with the event BEFORE the event saved.
How could this be solved, any hints?