module TutorSearch

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/tutor_search.rb, line 39
def as_indexed_json(options={})
  {
    id:       id,
    name:     name,
    full_name: full_name,
    email:    email,
    searchable: searchable?,
    average_rating: average_rating,
    rate_in_cents_with_charge: rate_in_cents_with_charge,
    subjects: subjects.map { |s|
      {
        _type: 'subject',
        _id:   s.id,
        name:  s.name
      }
    },
    courses: courses.includes(:subject).map { |c|
      {
        _type: 'course',
        _id:   c.id,
        name:  c.name,
        alternate_name: c.alternate_name,
        subject_name: c.subject_name

      }
    },
    categories: categories.map { |t|
      {
        _type: 'category',
        _id: t.id,
        name: t.name,
      }
    }
  }
end
as_json(options={}) click to toggle source

Calls Superclass Method

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