0
0
Fork 0

Migrate from ledermann/rails-settings to rails-settings-cached which allows global settings

with YAML-defined defaults. Add admin page for editing global settings. Add "site_description"
setting that would show as a paragraph on the frontpage
This commit is contained in:
Eugen Rochko 2017-01-12 20:46:24 +01:00
parent babc6a1528
commit b11fdc3ae3
20 changed files with 188 additions and 34 deletions

View file

@ -1,6 +1,8 @@
# frozen_string_literal: true
class User < ApplicationRecord
include RailsSettings::Extend
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable
belongs_to :account, inverse_of: :user
@ -14,11 +16,6 @@ class User < ApplicationRecord
scope :recent, -> { order('id desc') }
scope :admins, -> { where(admin: true) }
has_settings do |s|
s.key :notification_emails, defaults: { follow: false, reblog: false, favourite: false, mention: false, follow_request: true }
s.key :interactions, defaults: { must_be_follower: false, must_be_following: false }
end
def send_devise_notification(notification, *args)
devise_mailer.send(notification, self, *args).deliver_later
end