# Avoind access to some views

**URL:** <https://www.ruby-forum.com/t/avoind-access-to-some-views/159424>\
**Category:** Rails\
**Created:** [February 4, 2009, 1:19pm UTC](https://www.ruby-forum.com/t/avoind-access-to-some-views/159424 "2009-02-04T13:19:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adrianod](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c2a13f/32.png) [@adrianod](https://www.ruby-forum.com/u/adrianod)\
**Post date:** [February 4, 2009, 1:19pm UTC](https://www.ruby-forum.com/t/avoind-access-to-some-views/159424/1 "2009-02-04T13:19:19Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![adrianod](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c2a13f/32.png) [@adrianod](https://www.ruby-forum.com/u/adrianod)\
**Post date:** [February 4, 2009, 2:46pm UTC](https://www.ruby-forum.com/t/avoind-access-to-some-views/159424/2 "2009-02-04T14:46:42Z")

</div>

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/](http://random8.zenunit.com/)  
Learn rails: [http://sensei.zenunit.com/](http://sensei.zenunit.com/)

On 04/02/2009, at 11:19 PM, Adriano L.  
\<removed\_email\_address@domain.invalid
