cartodb/app/models/carto/snapshot.rb

16 lines
442 B
Ruby
Raw Normal View History

2020-06-15 10:58:47 +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