cartodb-4.42/app/models/carto/snapshot.rb
2024-04-06 05:25:13 +00:00

16 lines
442 B
Ruby

require 'json'
require_relative './carto_json_serializer'
module Carto
class Snapshot < ActiveRecord::Base
belongs_to :visualization, class_name: Carto::Visualization
belongs_to :user, class_name: Carto::User
default_scope { order('created_at DESC') }
serialize :state, ::Carto::CartoJsonSymbolizerSerializer
validates :state, carto_json_symbolizer: true
validates :visualization, :user, presence: true
end
end