views:

57

answers:

0

Hey guys,

This is my two model relationship.

  1. team has_many groups
  2. group belongs_to team

I have a sweeper that runs in my group model.

In my Team controller I have this in the after_create callback.

def after_create
self.groups.create(:name => DEFAULT_GROUP, :active => true, :description => "Parent group")
end

I am getting errors because the group sweeper runs when the Team creates the default group.

There is also no need for me to expire the cache for group, so is there a way to skip the sweeper from running ?

Maybe is there a better way of implementing this that I am missing ?