On Thu, Dec 4, 2008 at 6:00 AM, Dharmdip Rathod <
[EMAIL PROTECTED]> wrote:

>
> Frederick Cheung wrote:
> > On Dec 3, 1:20�pm, Dharmdip Rathod <[EMAIL PROTECTED]>
> > wrote:
> >> to delete all records based this method.
> >>
> >> i tried with people=People.find(:all, :conditions=>["id=?",params[:id]])
> >> but result is same.
> >>
> > This doesn't really make sense to me. There is only one record for a
> > given value of the id column (or rather rails assumes that id is your
> > primary key) so what were you expecting?
> >
> > Fred
>
> I want all records base on query which i have written in
> people=People.find(:all, :conditions=>["id=?",params[:id]])
> i am getting only one record not all records ...


I think this is not the real query you are having. you just chose a wrong
example

Assuming what u really want is  to semulate
people=People.find(:all, :conditions=>["country_id=?",params[:country_id]])
where country_id is a foreign key to something else

 People.find_by_country_id(params[:country_id])  will retrieve only the
first record matching the condition.

you should use  People.find_all_by_country_id(params[:country_id]) to get
all matching results.

hope it helps




-- 
Mahmoud Said
Software Developer
blog.modsaid.com
www.eSpace.com.eg

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to