module SubjectSearch

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/subject_search.rb, line 30
def as_indexed_json(options={})
  {
    id:       id,
    name:     name,
    description: description,
    courses: courses.map { |c|
      {
        _type: 'course',
        _id:   c.id,
        name:  c.name,
        teachers: c.teachers,
        mini_description: c.mini_description
      }
    },
    tutors: tutors.map { |t|
      {
        _type: 'tutor',
        _id: t.id,
        name: t.name
      }
    }
  }
end
as_json(options={}) click to toggle source

Calls Superclass Method

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