Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created October 6, 2021 06:30
Show Gist options
  • Save velotiotech/9cd362c30215d4e2b334076912056b1e to your computer and use it in GitHub Desktop.
Save velotiotech/9cd362c30215d4e2b334076912056b1e to your computer and use it in GitHub Desktop.
# == Schema Information
#
# Table name: users
#
# id :bigint not null, primary key
# name :string(255)
# email :string(255)
# mobile_number :string(255)
# created_at :datetime not null
# updated_at :datetime not null
#
class User < ApplicationRecord
searchkick
has_many :blogposts
def search_data
{
name: name,
email: email,
total_blogposts: blogposts.count,
last_published_blogpost_date: last_published_blogpost_date
}
end
...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment