1
2
3
4
5
6
7
8
9
10
  def browse
    if params[:year] and params[:month] and params[:day]
      browse_date = Date.new(params[:year], params[:month], params[:day])
    else 
      browse_date = Date.today
    end
    month_start = browse_date
    dates = (Event.find(:all, :conditions => ["starts_at > ?", month_start ]).map { |event| (event.starts_at.to_date..event.ends_at.to_date) })
    @dates = dates.map { |range| Array(range) }.flatten
  end