Skip to content

Commit

Permalink
start page is now not today but the last ten articles
Browse files Browse the repository at this point in the history
  • Loading branch information
TomK32 committed Apr 18, 2008
1 parent a1bf0a3 commit 7a674c9
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions app/controllers/timeline_controller.rb
Expand Up @@ -3,16 +3,14 @@ class TimelineController < ApplicationController

def articles_for
if params[:year].nil? or params[:month].nil? or params[:day].nil?
@current_date = Time.now
else
@current_date = Time.parse("#{params[:year]}-#{params[:month]}-#{params[:day]}")
@articles = Article.find :all, :order => 'published DESC', :limit => 10
else
@current_date = Time.now
@articles = Article.find :all, :include => :feed,
:conditions => ['published BETWEEN ? AND ?', @current_date.end_of_day, @current_date.beginning_of_day],
:order => 'published DESC'
end

@start_at = @current_date.end_of_day
@end_at = @current_date.beginning_of_day
@articles = Article.find :all,
:conditions => ['published BETWEEN ? AND ?', @end_at, @start_at],
:order => 'published DESC'
end

end

0 comments on commit 7a674c9

Please sign in to comment.