Sha256: 0a6a0d3c760fb273f0007568f99063f6ee4b373c12f4ede0ad25b15b7a55ecb4
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
= track_changes TrackChanges is a Rails plugin to facilitate tracking changes made to an ActiveRecord model in your Controller#update actions. By default, the block is only called if the changes hash is not empty. A TrackChanges::Filter is instantiated on each run of the <tt>before_filter</tt> so it should be thread-safe. Consult the generated rdoc for more information. == Example class PostController < ApplicationController include TrackChanges before_filter :get_post, :except => [:index, :new] track_changes_to :post do |r| # r.changes => Model#changes made during update action RAILS_DEFAULT_LOGGER.debug(r.changes.inspect) end def update if @post.update_attributes(params[:post]) flash[:notice] = "Success." else render :action => "edit" end end # Normal controller actions # ... protected def get_post @post = Post.find(params[:id]) end end == COPYRIGHT Copyright (c) 2008 Matt Haley. See LICENSE for details.
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
track_changes-0.3.2 | README.rdoc |
track_changes-0.3.0 | README.rdoc |