Class: Papercat::Document
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Papercat::Document
show all
- Defined in:
- app/models/papercat/document.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.at(pathname) ⇒ Object
4
5
6
|
# File 'app/models/papercat/document.rb', line 4
def self.at pathname
find_by("data #>> '{pathname}' = ?", pathname)
end
|
.get(conditions) ⇒ Object
8
9
10
|
# File 'app/models/papercat/document.rb', line 8
def self.get conditions
where("data @> '#{conditions.to_json}'")
end
|
Instance Method Details
#set(data) ⇒ Object
14
15
16
|
# File 'app/models/papercat/document.rb', line 14
def set data
update(data: self.data.deep_merge(data.deep_stringify_keys))
end
|