class PostsController < ApplicationController before_filter :get_user before_filter :get_post track_changes :post def index @posts = Post.all end def edit end def update if @post.update_attributes(params[:post]) flash[:notice] = "Post updated" redirect_to posts_url else render :action => "edit" end end protected def get_post Rails.logger.debug("get_post") @post = Post.find(params[:id]) end def get_user Rails.logger.debug("get_user") @user = User.find_by_id(params[:user_id]) end def current_user Rails.logger.debug("current_user") @user end end