That is may be a stupid point, but I don’t find the solution.
I have a simple model with a class method update_menu and I want that it is called after each save of instance.
Class Category
attr_accessible :name, :content
def self.menu
@@menu ||= update_menu
end
def self.update_menu
@@menu = Category.all
end
end
So what is the correct syntax to get the after_filter call update_menu?
I tried:
after_save :update_menu
But it looks for the method on the instance (which does not exist) and not on the class.
Thanks for your answers.
Make it an instance method by removing
self.It doesn’t make much sense to have an
after_savecallback on a class method. Classes aren’t saved, instances are. For example: