| Class | HomeController |
| In: |
app/controllers/home_controller.rb
|
| Parent: | ApplicationController |
Homepage
Show homepage
# File app/controllers/home_controller.rb, line 9
9: def index
10: @upcoming_events = UpcomingEvents.find_all(:weeks => RacingAssociation.current.weeks_of_upcoming_events)
11:
12: cutoff = Date.today - RacingAssociation.current.weeks_of_recent_results * 7
13:
14: @recent_results = Event.find(:all,
15: :select => "DISTINCT(events.id), events.name, events.parent_id, events.date, events.sanctioned_by",
16: :joins => [:races => :results],
17: :conditions => [
18: 'events.date > ? and events.sanctioned_by = ?',
19: cutoff, RacingAssociation.current.default_sanctioned_by
20: ],
21: :order => 'events.date desc'
22: )
23:
24: @news_category = ArticleCategory.find( :all, :conditions => ["name = 'news'"] )
25: @recent_news = Article.find(
26: :all,
27: :conditions => ['(created_at > ? OR updated_at > ?) and article_category_id = ?', cutoff, cutoff, @news_category],
28: :order => 'created_at desc'
29: )
30:
31: expires_in 1.hour, :public => true
32:
33: render_page
34: end