这是我当前的控制器:
def show
@lesson = @current_user.lessons.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @lesson }
end
end
目前用户只能访问他们自己的课程。如果他们访问 example.com/lessons/[其他人的公共课程 ID],则不会显示。
lesson
如果表格的列public
在其他人的课程中为真,我想允许用户显示他们自己的课程或其他人的课程。我怎样才能做到这一点?