Created
July 25, 2014 15:30
-
-
Save thanhcuong1990/c596d90369a3618fcba3 to your computer and use it in GitHub Desktop.
Fantastic filters example 4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /app/controllers/posts_controller.rb | |
class PostsController < ApplicationController | |
def edit | |
@post = get_post(params[:id]) | |
# ... | |
end | |
def update | |
@post = get_post(params[:id]) | |
# ... | |
end | |
def destroy | |
@post = get_post(params[:id]) | |
# ... | |
end | |
private | |
def get_post(post_id) | |
@post = Post.find(post_id) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment