Hello, I'm a Rails newbie.... Here's what I'm trying to do....
I created a scaffold for notes (t.text :content, t.integer :user_id)
What I want to do now is only allow user's to view notes that they
created. ie (== user_id)
In my /app/controllers/notes_controller.rb
I have the following:
class NotesController < ApplicationController
@noteuserid = Note.find(:conditions=>["note.user_id=?",
redirect_to(root_path) unless current_user?(@noteuserid)
I'm having problems understanding how to write the following line:
@noteuserid = Note.find(:conditions=>["note.user_id=?", @noteuserid])
Right now I'm using the system in the Rails 3 Tutorial Book:
Seems like the problem is current_user is an object, not an ID... Not
sure how to make the two comparable?