app/models/credit.rb
# returns a list of users enrolled in a credit
returns a list of users enrolled in a credit
returns a list of users enrolled in a credit
def active_enrolled_users_report
    User.find :all, 
      :joins => %Q{
        INNER JOIN enrollments e ON e.participant_id = users.id 
        INNER JOIN credit_assignments ca ON ca.enrollment_id = e.id
        INNER JOIN users co ON co.id = users.coordinator_id
        INNER JOIN contracts c ON c.id = e.contract_id
      },
      :conditions => %Q{
        (ca.enrollment_finalized_on IS NULL) AND
        (ca.user_id IS NULL) AND
        (ca.credit_id = #{self.id})
      },
      :select => "users.*, co.last_name AS coordinator_last_name, ca.credit_hours as credit_hours, c.id as enrollment_contract_id",
      :group => 'users.id',
      :order => 'co.last_name ASC, users.last_name ASC'
  end
def active_enrolled_users_report User . find :all , :joins => %Q{
        INNER JOIN enrollments e ON e.participant_id = users.id 
        INNER JOIN credit_assignments ca ON ca.enrollment_id = e.id
        INNER JOIN users co ON co.id = users.coordinator_id
        INNER JOIN contracts c ON c.id = e.contract_id
      } , :conditions => %Q{
        (ca.enrollment_finalized_on IS NULL) AND
        (ca.user_id IS NULL) AND
        (ca.credit_id = #{self.id})
      } , :select => "users.*, co.last_name AS coordinator_last_name, ca.credit_hours as credit_hours, c.id as enrollment_contract_id" , :group => 'users.id' , :order => 'co.last_name ASC, users.last_name ASC' end
returns a list of users enrolled in a credit
returns a list of users enrolled in a credit