Re: Find_by

milandobrota
Mon, 01 Feb 2010 22:56:53 -0000

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

--
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.