On Jun 25, 11:44 pm, Gearóid O'Ceallaigh <
gearoi...@gmail.com> wrote:
> Hey,
>
> I'm just getting used to ruby on rails and im designing a website that
> has a forum and a list of events. So there are two models: forum and
> event.
>
> I've got a method for event called find_upcoming_events which is used
> to list all future events. But I'd like to show the upcoming events at
> the bottom of the forum page but I'm unable to do this since the
> function belongs to event and not forum.
Sounds like find_upcoming_events should be a class method on Event,
which would mean you could call Event.find_upcoming_events (which I'd
probably shorten to Event.find_upcoming) anywhere you want. If that
sentence was gibberish, I suggest you read a little more about ruby/
object oriented programming in general.
Fred