module StudentSearch

Public Class Methods

Public Instance Methods

as_indexed_json(options={}) click to toggle source

This will return all the relevant rows from the database in json format

# File app/models/concerns/student_search.rb, line 31
def as_indexed_json(options={})

  {
    id:       id,
    name:     name,
    full_name: full_name,
    email:    email,
    searchable: searchable?,
    courses_studying: courses_studying.includes(:subject).map { |c|
      {
        _type: 'course',
        _id:   c.id,
        name:  c.name,
        alternate_name: c.alternate_name,
        subject_name: c.subject_name

      }
    },
    subjects_studying: subjects_studying.map { |s|
      {
        _type: 'subject',
        _id:   s.id,
        name:  s.name
      }
    }
  }
end
as_json(options={}) click to toggle source

Calls Superclass Method

Calls superclass method
# File app/models/concerns/student_search.rb, line 60
def as_json(options={})
  json = super(options)
  json[:_type] = "student"
  json
end