Newer
Older
dmpopidor / app / models / pref.rb
@Bodacious Bodacious on 12 Jul 2018 536 bytes Add annotate gem for models and Gemfile
# == Schema Information
#
# Table name: prefs
#
#  id       :integer          not null, primary key
#  settings :text
#  user_id  :integer
#

class Pref < ActiveRecord::Base
  ##
  # Serialize prefs to JSON
  # The settings object only stores deviations from the default
  serialize :settings, JSON

  ##
  # Associations
  belongs_to :user

  ##
  # Returns the hash generated from default preferences
  #
  # @return [JSON] preferences hash
  def self.default_settings
    return Rails.configuration.branding[:preferences]
  end

end