Module: AttrJson::Record::QueryScopes

Extended by:
ActiveSupport::Concern
Defined in:
lib/attr_json/record/query_scopes.rb

Overview

Adds query-ing scopes into a AttrJson::Record, based on postgres jsonb.

Has to be mixed into something that also is a AttrJson::Record please!

See more in README docs.

Examples:

class MyRecord < ActiveRecord::Base
  include AttrJson::Record
  include AttrJson::Record::QueryScopes

  attr_json :a_string, :string
end

some_model.jsonb_contains(a_string: "foo").first

some_model.not_jsonb_contains(a_string: "bar").first