class Recruiter < ApplicationRecord
  devise :database_authenticatable, :registerable, :confirmable,
         :recoverable, :rememberable, :trackable, :validatable,
         :lockable
end

class Recruiter < ApplicationRecord
  store :preferences, accessors: [ :language, :location ], coder: JSON
  devise :database_authenticatable, :registerable, :confirmable,
         :recoverable, :rememberable, :trackable, :validatable,
         :lockable

  after_commit :expire_search_query, if: :preferences_previously_changed?

  private

  def expire_search_query
    Rails.cache.delete('search_query')
  end
end

Add store accessor for preferences and expire search query if preferences update
Add store accessor for preferences and expire search query if preferences update
