cartodb-4.42/app/models/carto/snapshot.rb

16 lines
442 B
Ruby
Raw Normal View History

2024-04-06 13:25:13 +08:00
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