Skip to content

Instantly share code, notes, and snippets.

@ratnikov
Created March 6, 2011 21:14
Show Gist options
  • Select an option

  • Save ratnikov/857678 to your computer and use it in GitHub Desktop.

Select an option

Save ratnikov/857678 to your computer and use it in GitHub Desktop.
class ApplicationController
after_filter :record_create, :only => [ :create ]
after_filter :record_update, :only => [ :update ]
after_filter :record_destroy, :only => [ :destroy ]
private
def record_create
Event.create! :record => record, :controller => name, :action => :create unless record.previous_changes.empty?
end
# ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment