Sha256: 03d6a9ac0f382d0d9fb4b1a9739ea81162744c43b09fb5d6d577ad3dd34c979d

Contents?: true

Size: 692 Bytes

Versions: 3

Compression:

Stored size: 692 Bytes

Contents

# frozen_string_literal: true

class Tramway::User::UserDecorator < ::Tramway::Core::ApplicationDecorator
  class << self
    def collections
      [:all]
    end

    def list_attributes
      [:email]
    end

    def show_attributes
      %i[email first_name last_name phone role created_at updated_at]
    end

    if defined? Tramway::Conference
      def show_associations
        [:social_networks]
      end
    end
  end

  decorate_association :social_networks, as: :record if defined? Tramway::Conference

  delegate_attributes :first_name, :last_name, :email, :phone, :role, :created_at, :updated_at, :admin?

  def name
    "#{object&.first_name} #{object&.last_name}"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tramway-user-2.1.3.4 app/decorators/tramway/user/user_decorator.rb
tramway-user-2.1.3.3 app/decorators/tramway/user/user_decorator.rb
tramway-user-2.1.3.2 app/decorators/tramway/user/user_decorator.rb