Forum: Ruby on Rails Avoind access to some views

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Adriano L. (Guest)
on 2009-02-04 14:19
Hi I want to do a simple create method and then it will open a view
(show) to show all the data that was inputed (pretty simple).
But I want the person to see the show ONLY when he/she first input his
data (for example after the create it will redirect to show in
localhost/anything/1 )
But I dont want to be possible to ppl go to localhost/anything/1 and see
other people data, is there a way to do it ?
Julian L. (Guest)
on 2009-02-04 15:46
(Received via mailing list)
It's called scoping. Imagine I have a logged in user, and they can
view a list of, say, posts. Post belongs to user  which (almost
obviously) therefore has many posts. Then, we do this for the view:

@post = logged_in_user.posts.find(params[:id])

Learn rails:

On 04/02/2009, at 11:19 PM, Adriano L.
This topic is locked and can not be replied to.