0

我是一名业余程序员,正在开发 ruby​​ on rails 应用程序。到目前为止,一切都运行顺利,但现在我遇到了问题。每次我尝试访问我的“约会”模型时,服务器都会卡住并且无法加载页面。这是我的控制器的索引:

class AppointmentsController < ApplicationController
load_and_authorize_resource
before_filter :get_appointments, :only => :index
def index
    @appointments = Appointment.all
    @months = ["January","February","March","April","May","June","July","August", "September", "October", "November", "December"]
    @appointments = @appointments.select {|appointment| appointment.seller_id == current_user.id }
    @appointments = @appointments.select {|appointment| appointment.completed == false }
    @appointments.sort! { |a,b| a.date_time <=> b.date_time }
end

我不认为问题出在视图上,因为我可以注释掉这段代码,然后服务器会加载页面。这是模型

class Appointment < ActiveRecord::Base
  attr_accessible :buyer_id, :item_id, :seller_id, :location, :date_time
  belongs_to :item

end

知道问题可能是什么吗?请帮忙!谢谢!

罗汉

4

1 回答 1

0

好吧,这很尴尬..查看页面有问题。它陷入了无限循环。问题已解决,还是感谢您的帮助!

于 2012-11-15T23:35:27.463 回答