在Rails 2.3.8中使用event_calendar时出错

时间:2011-09-19 11:00:22

标签: ruby-on-rails

我在Rails 2.3.8中使用event_calendar开发了一个项目。我已将其实现为在日历上显示结果,但是当用户尝试导航到下一个月或上个月的日历时会出现问题。它显示了所有事件,它没有显示该月份的搜索结果。

应用\控制器\ calendar_controller.rb

class CalendarController < ApplicationController
  @@id = nil

  def index
    @var = params[:event]
    @month = (params[:month] || (Time.zone || Time).now.month).to_i
    @year = (params[:year] || (Time.zone || Time).now.year).to_i
    @shown_month = Date.civil(@year, @month)    
    @first_day_of_week = 1

    if params[:my].nil?
      if (defined? (params[:event][:trainer_id]))
        params[:my] = (params[:event][:trainer_id])
        @@id = (params[:event][:trainer_id])
        @event_strips = Event.event_strips_for_month(@shown_month, @first_day_of_week, :conditions=>["trainer_id = ?",params[:my]])         
      else
        @event_strips = Event.event_strips_for_month(@shown_month, @first_day_of_week)              
      end
    else
      @event_strips = Event.event_strips_for_month(@shown_month, @first_day_of_week, :conditions=>["trainer_id = ?",params[:my]])           
    end 

  end
end

0 个答案:

没有答案