A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.
posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord
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") |
def match_host(issue_url) | |
Matchers::GitHost.(issue_url) do |m| | |
m.success(:github) { |issue_data| Services::GithubIssueRequester.(issue_data) } | |
m.success(:gitlab) { |issue_data| Services::GitlabIssueRequester.(issue_data) } | |
m.failure do | |
error('invalid url') | |
INVALID_URL_ERROR | |
end | |
end | |
end |
def match_host(issue_url) | |
Container['matchers.git_host'].(issue_url) do |m| | |
m.success(:github) { |issue_data| Container['services.github_issue_requester'].(issue_data) } | |
m.success(:gitlab) { |issue_data| Container['services.gitlab_issue_requester'].(issue_data) } | |
m.failure do | |
error('invalid url') | |
INVALID_URL_ERROR | |
end | |
end | |
end |
This temporary workaround is helpful, when test-kitchen is unable to connect to centos vm box via ssh with following error messages:
Waiting for SSH service on 127.0.0.1:2222, retrying in 3 seconds
Waiting for SSH service on 127.0.0.1:2222, retrying in 3 seconds
Waiting for SSH service on 127.0.0.1:2222, retrying in 3 seconds
Waiting for SSH service on 127.0.0.1:2222, retrying in 3 seconds
For kitchen create
to work properly, one should create Vagrantfile.rb
(extension is mandatory here) anywhere, and specify the path to this file in .kitchen.yml
. The only content of this custom Vagrantfile
is insert_key
setting, because it's not being parsed properly by test-kitchen
, when provided in .kitchen.yml
.