Re: Find_by

RubyonRails_newbie
Tue, 02 Feb 2010 08:52:48 -0000

No - sorry my poor explanation..

I have a site that people can join and add friends.

I want to add a feature that suggests friends for them.

So – for example user X has registered and filled in details such as
‘current location’ = London
Fav Movie = ‘Avatar’ etc

I’d like to be able to then use ruby on rails to go off and find other
registered users that have similar or same interests

Hope this is clearer…?


On 1 Feb, 22:56, milandobrota
<elitecod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> I''m not sure I understand your question. Do you need a list of
cities
> near London that you want to search through? Or you have a problem
> with views?
>
> Regards,
> Milan
>
> On Feb 1, 11:30 pm, RubyonRails_newbie
<craigwest...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
> wrote:
>
>
>
> > Hi All,
>
> > I''m looking to improve finding friends on my site, by adding
a
> > ''''suggestion'''' page/area.
>
> > BAsically, a query should be run against a logged in user and find
> > other people from the same town/location. Or that share a similar
> > hobby etc.
>
> > I have a controller and an index page i want to update this with.
>
> > what I have so far:
>
> > Controller:
>
> >   def thingsincommon
> >        @users = User.find_by_user_id( @user.id, 1, :limit =>
> > 1, :conditions => "location like
''London%''")
>
> >   end
>
> > To be honest, this query would only work for thise people who live
> > near somewhere similar to london. Is it possible to amend it further
> > to read the user''s location (which they add as part of
further site
> > registration) so then the query is looking for other people nearby
> > etc?
>
> > Html.erb:
>
> >                 <% if @user.thingsincommon %>
>
> >         <% end %>
>
> > Thing is, i can''t find a tutorial to cover this, so I can see
the
> > example. The api site is handy for controller stuff, but when I want
> > to render results based on the query, I''m finding it
difficult..
>
> > Any ideas how to accomplish this?
>
> > Kind Regards- Hide quoted text -
>
> - Show quoted text -

--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.