Forum: Ruby on Rails Avoind access to some views

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community 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])

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

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