Skip to content

Instantly share code, notes, and snippets.

@thanhcuong1990
Created July 25, 2014 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thanhcuong1990/2c723d68ca21eed7c6ae to your computer and use it in GitHub Desktop.
Save thanhcuong1990/2c723d68ca21eed7c6ae to your computer and use it in GitHub Desktop.
Fantastic filters example 3
# /app/controllers/posts_controller.rb
class PostsController < ApplicationController
before_filter :get_post, :only => [:edit, :update, :destroy]
def edit
# ...
end
def update
# ...
end
def destroy
# ...
end
private
def get_post
@post = Post.find(params[:id])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment