Skip to content

Instantly share code, notes, and snippets.

@thanhcuong1990
Created July 25, 2014 15:16
Show Gist options
  • Select an option

  • Save thanhcuong1990/e0fcb5e38dde1aedb19e to your computer and use it in GitHub Desktop.

Select an option

Save thanhcuong1990/e0fcb5e38dde1aedb19e to your computer and use it in GitHub Desktop.
Fantastic filters example 2
# /app/controllers/posts_controller.rb
class PostsController < ApplicationController
before_filter :get_post, :only => [:edit, :update, :destroy]
def get_post
@post = Post.find(params[:id])
end
def edit
# ...
end
def update
# ...
end
def destroy
# ...
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment