2
decent_exposure 젬을 railscast으로 성공적으로 설정했습니다.레일 3 - current_user 및 decent_exposure를 사용하여 범위 액세스
개체 소유자를 current_user와 비교하여 권한을 확인하지 않으려면 편집/업데이트/만들기 작업에 current_user와 함께 범위 액세스를 사용하고 싶습니다.
컨트롤러 : 내가 예를 들어 내 편집 액션이 같은 decent_exposure의 뭔가가 어떻게
class CommentsController < ApplicationController
expose(:article)
expose(:comments) { article.comments }
expose(:comment)
def index
end
def new
end
def create
if comment.save
redirect_to comment.article, :notice => "Successfully created comment!"
else
render :new
end
end
end
: 사전에
@comment = current_user.comments.find(params[:id])
감사합니다!