Sha256: 3821b26cd8fec785649ba8c907755a94022ae76d937823018d639a77bdf80511
Contents?: true
Size: 762 Bytes
Versions: 1
Compression:
Stored size: 762 Bytes
Contents
require 'track_changes' class PostsController < ApplicationController include TrackChanges before_filter :find_post track_changes :post, :only => :update def show render :text => @post.inspect end # PUT /posts/1 # PUT /posts/1.xml def update respond_to do |format| if @post.update_attributes(params[:post]) flash[:notice] = 'Post was successfully updated.' format.html { redirect_to(@post) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @post.errors, :status => :unprocessable_entity } end end end protected def current_user "John Smith" end def find_post @post = Post.find(params[:id]) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
track_changes-0.5.0 | test/rails_root/app/controllers/posts_controller.rb |