# About show list

**URL:** <https://www.ruby-forum.com/t/about-show-list/163937>\
**Category:** Rails\
**Created:** [March 26, 2009, 10:44am UTC](https://www.ruby-forum.com/t/about-show-list/163937 "2009-03-26T10:44:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ple\_mazako](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5daacb/32.png) [@ple\_mazako](https://www.ruby-forum.com/u/ple_mazako)\
**Post date:** [March 26, 2009, 10:44am UTC](https://www.ruby-forum.com/t/about-show-list/163937/1 "2009-03-26T10:44:23Z")

</div>

hello,  
i want to create database for individual user .  
when user login and add sequences in to database .the web page show  
list of sequences that user have in database. but when i try show the  
list of of sequences  
.it’s show all list of sequence in database. such as the total  
sequences that user A add are 3 items and the total sequences that  
user B add are 5 items.  
when user A login and want to see own data .the web page show 8  
items.in fact it’s show 3 items. how i fix this the problem.

> > class ComponentsController \< ApplicationController  
> > before\_filter :protect, :only =\> [:show, :edit]  
> > def index  
> > @title = “list of sequences”  
> > @items = Seq.find(:all)  
> > end  
> > def databases  
> > @title = “Database”  
> > if request.post?and params[:seq]  
> > params[:seq][:sequence].gsub!(/\s/,"")  
> > params[:seq][:sequence].upcase!  
> > @seq = Seq.new(params[:seq])  
> > if @seq.save  
> > flash[:notice] = “sequence submitted !”  
> > redirect\_to :action =\> “show”, :id =\> @seq.id  
> > end  
> > end  
> > end

---

<div class="post-metadata">

**Author:** ![ple\_mazako](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5daacb/32.png) [@ple\_mazako](https://www.ruby-forum.com/u/ple_mazako)\
**Post date:** [March 26, 2009, 2:43pm UTC](https://www.ruby-forum.com/t/about-show-list/163937/2 "2009-03-26T14:43:00Z")

</div>

> def index  
> @title = “list of sequences”  
> @items = Seq.find(:all)  
> end

That method shouldn’t be doing a wide-open find. You need to scope the  
find somehow, and deal with the case where the current user isn’t logged  
in yet.

---

<div class="post-metadata">

**Author:** ![ple\_mazako](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5daacb/32.png) [@ple\_mazako](https://www.ruby-forum.com/u/ple_mazako)\
**Post date:** [March 26, 2009, 4:59pm UTC](https://www.ruby-forum.com/t/about-show-list/163937/3 "2009-03-26T16:59:49Z")

</div>

thank you for your suggestion .

2009/3/26 Ar Chron [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
