undefined method `model_name' for ActiveRecord::Relation:Class

I'm trying to create a spreadsheet using ekuseru.

I have a form that a user enters a course number in and submits. Like
'HA2211'. The action in my controller this goes to is
course_enrollment. The view is course_enrollment.xls.eku.

My controller: (in part)
class Sso::ReportsController < ApplicationController
  respond_to :html, :xls

  def course_enrollment
    # create vars long_nbr, short_nbr, ten_semesters_ago from
paras[:course] sent from form
    long_nbr = params[:course].slice(2,4)
    short_nbr = params[:course].slice(3,3)
    ten_semesters_ago = ''
    if CourseTaken.last_semester == 20
      ten_semesters_ago = (Time.now.year-5).to_s + '20'
      ten_semesters_ago = (Time.now.year-6).to_s + '70'
    @students = CourseTaken.students_enrolled_in_course(long_nbr,
short_nbr, ten_semesters_ago)
    if !@students.nil?
      respond_with @students, :format => :xls

The error I get is:
undefined method `model_name' for ActiveRecord::Relation:Class
app/controllers/sso/reports_controller.rb:33:in `course_enrollment'

Line 33 in my controller is:

respond_with @students, :format => :xls

I have a correctly named view: course_enrollment.xls.eku

I've tested and verified via my console the line:

@students = CourseTaken.students_enrolled_in_course(long_nbr, short_nbr,

This works and @students is not nill.

I do pretty much the same thing in another action for another
spreadsheet report and it works fine. I've searched and googled but
cannot find what my problem might be.

Thanks for any tips or pointers.

Can you show the code for the CourseTaken.students_enrolled_in_course method?

Thanks for looking at my problem. I hope this is what you need.

I am using a named_scope (or just scope - rails 3):

scope :students_enrolled_in_course, lambda { |*args| {
              :conditions => ["crs_key > ? AND
                               final_gr IS NOT NULL AND
                               (crs_id in (?,?) AND
                               crs_coll in ('HA','HO') AND
                               substr(crs_id,3) in
                               (SELECT crs_link FROM sso.courses WHERE
crs_no in (?, ?)))",
                                 args[2], 'HA'+args[1].to_s,
'HA'+args[0].to_s, 'HA'+args[0].to_s, 'HA'+args[1].to_s ],
              :order => "crs_key"

The resulting sql this results in is thus:

200620 AND

final_gr IS NOT NULL AND
(crs_id in ('HA211','HA2211') AND
crs_coll in ('HA','HO') AND
substr(crs_id,3) in
   (SELECT crs_link FROM sso.courses WHERE crs_no in
ORDER BY crs_key

I've run this in our Oracle DB and I get 500+ records.