Skip to content

Instantly share code, notes, and snippets.

View krzykamil's full-sized avatar
🤔

Krzysztof Piotrowski krzykamil

🤔
View GitHub Profile
require 'elasticsearch/model'
module Concerns
module Author
module Searchable
extend ActiveSupport::Concern
included do
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks
class Author < ActiveRecord::Base
include Concerns::Author::Searchable
...
...
end
/*
We have an array of objects representing different people in our contacts lists.
A lookUpProfile function that takes firstName and a property (prop) as arguments has been pre-written for you.
The function should check if firstName is an actual contact's firstName and the given property (prop) is a property of that contact.
If both are true, then return the "value" of that property.
If firstName does not correspond to any contacts then return "No such contact"
If prop does not correspond to any valid properties then return "No such property"
*/
//Setup