我是Rails的新手控制访问记录....这是我正在试图做的....Rails 3中,帮助基于用户ID
我创建了笔记支架( t.text:content,t.integer:user_id)
我现在想要做的只是允许用户查看他们创建的笔记。即(== USER_ID)
在我/app/controllers/notes_controller.rb
我有以下几点:
class NotesController < ApplicationController
before_filter :authenticate
before_filter :correct_user
.
.
.
.
def correct_user
@noteuserid = Note.find(:conditions=>["note.user_id=?", @noteuserid])
redirect_to(root_path) unless current_user?(@noteuserid)
end
我在了解如何编写以下行的问题:@ noteusefind(:conditions => [“note.user_id =?”,@noteuserid])
任何想法?
感谢
不应该工作的呢?注意:([“user_id =?”,current_user]) – AnApprentice 2010-09-05 22:13:57