Sha256: 7eb0a8e01ccddeb7e4eb8c68204b3d56e67262d7dff3b4307004e6cbd90fe210

Contents?: true

Size: 604 Bytes

Versions: 8

Compression:

Stored size: 604 Bytes

Contents

# frozen_string_literal: true

module V1
  module Resources
    class User < Base
      model ::User

      # Mappings for the allowed filters
      filters_mapping(
        'uuid': 'uuid',
        'first_name': 'first_name',
        'last_name': 'last_name',
        'email': 'email'
      )

      # To compute the full_name (method below) we need to load first and last names from the DB
      property :full_name, dependencies: %i[first_name last_name]

      # Computed attribute that combines first and last
      def full_name
        [first_name, last_name].join(' ')
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
praxis-2.0.pre.18 tasks/thor/templates/generator/example_app/app/v1/resources/user.rb
praxis-2.0.pre.17 tasks/thor/templates/generator/example_app/app/v1/resources/user.rb
praxis-2.0.pre.16 tasks/thor/templates/generator/example_app/app/v1/resources/user.rb
praxis-2.0.pre.15 tasks/thor/templates/generator/example_app/app/v1/resources/user.rb
praxis-2.0.pre.14 tasks/thor/templates/generator/example_app/app/v1/resources/user.rb
praxis-2.0.pre.13 tasks/thor/templates/generator/example_app/app/v1/resources/user.rb
praxis-2.0.pre.12 tasks/thor/templates/generator/example_app/app/v1/resources/user.rb
praxis-2.0.pre.11 tasks/thor/templates/generator/example_app/app/v1/resources/user.rb