Sha256: c0c3a73cd196423cef0af21a2604674dc747eb557a7dcea2b830b0f4f938d9fa

Contents?: true

Size: 787 Bytes

Versions: 1

Compression:

Stored size: 787 Bytes

Contents

# frozen_string_literal: true

# == Schema Information
#
# Table name: settings
#
#  id          :integer          not null, primary key
#  var         :string(50)       not null
#  value       :text
#  target_id   :integer
#  target_type :string(30)
#  created_at  :datetime
#  updated_at  :datetime
#

require 'rails-settings-cached'

class Settings < RailsSettings::CachedSettings
  include PublicActivity::Model

  tracked owner: ->(controller, _model) { controller.try(:current_user) }

  def self.update_attributes(attributes)
    attributes.each do |key, value|
      self[key] = value
    end
  end

  def self.thing_scoped
    unscoped.where('target_type is NULL and target_id is NULL')
  end

  def self.to_key
    ['settings']
  end

  def self.persisted?
    false
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/models/defaults/settings.rb