Skip to main content
Version: 1.6

Internal

Internal private attributes can be defined through the internal method.

Options

Option type

This option is validation. It will check that the value set to internal corresponds to the specified type (class). In this case is_a? method is used.

class NotificationService::Create < ApplicationService::Base
input :user, type: User

internal :inviter, type: User

output :notification, type: Notification

make :assign_inviter
make :create_notification!

private

def assign_inviter
self.inviter = user.inviter
end

def create_notification!
self.notification = Notification.create!(user: inputs.user, inviter:)
end
end