Skip to content

Instantly share code, notes, and snippets.

@pwightman
Created January 28, 2013 19:29
Show Gist options
  • Save pwightman/4658304 to your computer and use it in GitHub Desktop.
Save pwightman/4658304 to your computer and use it in GitHub Desktop.
def UsersController
before_filter :get_user, only: [:show, :update]
def show
# You can use the @user variable here...
end
def update
# You can use the @user variable here...
end
def index
# You CANNOT use the @user variable here...
end
private
def get_user
@user = User.find_by_id(params[:id])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment