I'm an amateur programmer working on a ruby on rails application. Up until now, everything has been running smoothly, but now I'm running into a problem. Every time I try to access my 'appointment' model, the server gets stuck and fails to load a page. Here is the index of my controller:
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
I don't think the issue is with the view, because I could comment this code out, and then the server would load the page. Here's the model
class Appointment < ActiveRecord::Base
attr_accessible :buyer_id, :item_id, :seller_id, :location, :date_time
belongs_to :item
end
Any idea what the issue could be? Help please! Thanks!
Rohan