Assuming this table definition:
CREATE TABLE segments (segments_id serial PRIMARY KEY, payload jsonb);
With JSON values like this:
INSERT INTO segments (payload)
VALUES ('{
"a": [
{
"kind": "person",
sudo vim /etc/sudoers | |
https://docs.google.com/document/d/1cXS-hQ09_AXATTjcvpKqzrqVEwATsZHY9t2VfTkxRYg/edit#heading=h.wxbnbz4dhgpy | |
https://www.digitalocean.com/community/tutorials/how-to-install-software-on-kubernetes-clusters-with-the-helm-package-manager | |
https://docs.helm.sh/using_helm/#quickstart-guide | |
helm installed into /usr/local/bin/helm | |
tiller installed into /usr/local/bin/tiller | |
Run 'helm init' to configure helm. |
#send a message between two users. This will create a Mailoxer::Conversation behind the scene. | |
user_1 = User.where(email: 'user email').first | |
user_2 = User.where(email: 'user email').first | |
message_subject = "Review of work" | |
message_body = "Kindly look at my submitted work" | |
user_1.send_message(user_2, message_body , message_subject) | |
#starting Mail_boxer::Conversation | |
a = Mailboxer::Conversation.find(1) | |
yy = a.mesages |
<%= f.input key, | |
as: :multi_value, | |
input_html: { | |
class: 'form-control', | |
id: 'ubiquity-funder', | |
data: { 'autocomplete-url' => "/authorities/search/local/funder", | |
'autocomplete' => key } | |
}, | |
required: f.object.required?(key) %> |
<%= presenter.attribute_to_html(:creator, render_as: :creator) %> |
<%= presenter.attribute_to_html(:formatted_creator, render_as: :faceted) %> |
<%= | |
f.input :contributor_group, as: :contributor_group_type, | |
wrapper_html: { class: 'multi_value' }, | |
input_html: { class: 'form-control', multiple: true }, | |
include_blank: true, | |
required: f.object.required?(key) | |
%> |
module BinarySearchTree | |
class Node | |
include Comparable | |
attr_reader :value | |
attr_accessor :left, :right, :nodes_tracker | |
def initialize(value) | |
@value = value | |
self.nodes_tracker = [] |
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query | |
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails | |
#payload: [{"kind"=>"person"}] | |
Segment.where("payload @> ?", [{kind: "person"}].to_json) | |
#data: {"interest"=>["music", "movies", "programming"]} | |
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json) | |
Segment.where("data #>> '{interest, 1}' = 'movies' ") | |
Segment.where("jsonb_array_length(data->'interest') > 1") |
Assuming this table definition:
CREATE TABLE segments (segments_id serial PRIMARY KEY, payload jsonb);
With JSON values like this:
INSERT INTO segments (payload)
VALUES ('{
"a": [
{
"kind": "person",