Ruby on Rails Tuesday, December 14, 2010

> Why the current_user part? Just Timesheet.find(params[:id]) should do
> the trick -- after all, the ID is unique.

I read in Beginning Rails 3 that current_user makes sure that the logged
in user can not see other people's incidents/timesheets. I have the same
thing in the IncidentsController:
------------------------------
def index
@incidents = current_user.incidents.all
-------------------------------


> Of course that's not working. You haven't defined timesheet anywhere.

@timesheet = Timesheet.find(params[:id])

Seems to be not working... Does it even need to find by ID if I'm
already using the incident_timesheet_path(incident) link?

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment