Sha256: 2d307e83aa6a8c5cd30b3df025826a5225830b2f3b5ca0417984c343dfcb9a10
Contents?: true
Size: 627 Bytes
Versions: 36
Compression:
Stored size: 627 Bytes
Contents
module Refine module Stabilizers class DatabaseStabilizer def to_stable_id(filter:, name: nil) # Serialize the filter class and blueprint. Reference via id. model.find_or_create_by!(state: filter.state, name: name).id end def from_stable_id(id:, initial_query: nil) # Find the associated StoredFilter by id and return state. Decode to create blueprint state = ActiveSupport::JSON.decode(model.find(id).state).deep_symbolize_keys Refine::Filter.from_state(state, initial_query) end def model Refine::StoredFilter end end end end
Version data entries
36 entries across 36 versions & 1 rubygems