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

22 lines
438 B
Ruby
Raw Normal View History

2024-04-06 13:25:13 +08:00
require 'json'
require_relative './carto_json_serializer'
class Carto::State < ActiveRecord::Base
belongs_to :visualization, class_name: Carto::Visualization
serialize :json, ::Carto::CartoJsonSymbolizerSerializer
validates :json, carto_json_symbolizer: true
after_initialize :ensure_json
def self.columns
super.reject { |c| c.name == 'user_id' }
end
private
def ensure_json
self.json ||= Hash.new
end
end