I'm getting the follow error:
ActionView::Template::Error (undefined method `each' for nil:NilClass):
Here is the where clause, the first one works.
def self.unpaid
ARequest.where(:paid_on => nil).in(:status => [ARequest::TRANS_COMPLETE,ARequest::CANCELLED_BY]).gt(:total_owed_to_driver_in_cents => 0).asc(:assigned_driver_id).asc(:timestamp_requested)
end
This does NOT work.
def self.allcall
longtimeago = Time.now - 60.day
yesterday = Time.now - 1.day
ARequest.where(["paid_on >= ? AND paid_on <= ?", longtimeago.beginning_of_day, yesterday.end_of_day]).in(:status => [ARequest::TRANS_COMPLETE,ARequest::CANCELLED_BY]).gt(:total_owed => 0).asc(:assigned_driver_id).asc(:timestamp_requested)
end
The above throws this error:
ActionView::Template::Error (undefined method `each' for nil:NilClass):
CONTROLLER CODE
def allcalls
ensure_root
@calls = ARequest.allcall
end
ROUTE
get "sme/allcalls"
Just try to change
where(["paid_on >= ? AND paid_on <= ?", longtimeago.beginning_of_day, yesterday.end_of_day])
to
where("paid_on >= ? AND paid_on <= ?", longtimeago.beginning_of_day, yesterday.end_of_day)