Sha256: 9c19729ed80bebc66c0ee98498e3a65cf6dc482a1ecbcbd1a0e94b49e6808ca5

Contents?: true

Size: 688 Bytes

Versions: 5

Compression:

Stored size: 688 Bytes

Contents

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
track_changes-1.0.1 test/railsapp/app/controllers/posts_controller.rb
track_changes-1.0.0 test/railsapp/app/controllers/posts_controller.rb
track_changes-1.0.0.pre3 test/railsapp/app/controllers/posts_controller.rb
track_changes-1.0.0.pre2 test/railsapp/app/controllers/posts_controller.rb
track_changes-1.0.0.pre1 test/railsapp/app/controllers/posts_controller.rb