mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
Lunchflow settings family (#363)
* Move provider config to family * remove global settings * Remove turbo auto submit * Fix flash location * Fix mssing syncer for lunchflow * Update schema.rb * FIX tests and encryption config * FIX make rabbit happy * FIX run migration in SQL * FIX turbo frame modal * Branding fixes * FIX rabbit * OCD with product names * More OCD * No other console.log|warn in codebase --------- Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
This commit is contained in:
@@ -4,11 +4,22 @@ class PlaidItem < ApplicationRecord
|
||||
enum :plaid_region, { us: "us", eu: "eu" }
|
||||
enum :status, { good: "good", requires_update: "requires_update" }, default: :good
|
||||
|
||||
if Rails.application.credentials.active_record_encryption.present?
|
||||
# Helper to detect if ActiveRecord Encryption is configured for this app
|
||||
def self.encryption_ready?
|
||||
creds_ready = Rails.application.credentials.active_record_encryption.present?
|
||||
env_ready = ENV["ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY"].present? &&
|
||||
ENV["ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY"].present? &&
|
||||
ENV["ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT"].present?
|
||||
creds_ready || env_ready
|
||||
end
|
||||
|
||||
# Encrypt sensitive credentials if ActiveRecord encryption is configured (credentials OR env vars)
|
||||
if encryption_ready?
|
||||
encrypts :access_token, deterministic: true
|
||||
end
|
||||
|
||||
validates :name, :access_token, presence: true
|
||||
validates :name, presence: true
|
||||
validates :access_token, presence: true, on: :create
|
||||
|
||||
before_destroy :remove_plaid_item
|
||||
|
||||
|
||||
Reference in New Issue
Block a user