Sha256: c03a4ed93af018d99b3668a361f984e2c1628206c127f7f306a5a169d8273517

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

module Pageflow
  class Account < ApplicationRecord
    include FeatureTarget
    include SerializationBlacklist

    has_many :entries, dependent: :restrict_with_exception
    has_many :folders, dependent: :destroy
    has_many :memberships, as: :entity, dependent: :restrict_with_exception
    has_many :users, through: :memberships, source: :user, class_name: '::User'
    has_many :entry_memberships, through: :entries, source: :memberships

    has_many :sites, dependent: :destroy
    belongs_to :default_site, :class_name => 'Site'

    validates :default_site, :presence => true

    accepts_nested_attributes_for :default_site, :update_only => true

    scope :with_landing_page, -> { where.not(:landing_page_name => '') }

    def build_default_site(*args)
      super.tap do |site|
        site.account = self
      end
    end

    def blacklist_for_serialization
      [:features_configuration]
    end

    def self.ransackable_attributes(_auth_object = nil)
      %w[id name]
    end

    def self.ransackable_associations(_auth_object = nil)
      []
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pageflow-17.0.4 app/models/pageflow/account.rb
pageflow-17.0.3 app/models/pageflow/account.rb
pageflow-17.0.2 app/models/pageflow/account.rb
pageflow-17.0.1 app/models/pageflow/account.rb
pageflow-17.0.0 app/models/pageflow/account.rb
pageflow-16.2.0 app/models/pageflow/account.rb