Cheers, that worked perfectly.

What I'm trying to do now is to list the events which belong to these
"nearby_venues" and which occur after todays date. I have no problem
in getting the events from the nearby venues but am having problems
when trying to couple this with the date condiiton.

My current code looks like this:

@today = Date.today

@upcoming_events = Event.find(:all, :conditions => {"venue_id = ? and
date > ?", @nearby_venues, @today}, order => date)

This throws up an error since theres more than one value in
@nearby_venues so I try using the solution given above, and it looks
as follows:

@upcoming_events = Event.find(:all, :conditions => {:venue_id =>
@nearby_venues and :date > @today}, order => date)

This doesn't work either however, any advice?


On 24 Sep, 10:06, Erol Fornoles <[EMAIL PROTECTED]> wrote:
> On Sep 24, 4:53 pm, Gearóid O'Ceallaigh <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi
>
> > I'm trying to perform a simple find on a class but am having trouble
> > implementing it.
>
> > What I want to perform a dynamic find for each different user. The
> > user's location would be variable and I want to display all the
> > relevant venues for that user.
>
> > My code currently looks something like this:
>
> > @location = @current_user.location
>
> > @nearby_venues = Venue.find(:all, :conditions => location_id =
> > @location, :order => 'name')
>
> > This does not work however. I've tried changing the conditions
> > statement around a bit but with no luck.
>
> > If anybody could tell me how to perform this find, it'd really help me
> > out.
>
> > Thanks in advance.
>
> You need to correct your :conditions
>
> :conditions => {:location_id => @location.id}
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
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