Skip to content

Delegations are not inherited #12

Description

@opensourceame
class ParentService < Servitium::Service
  context do
    attribute :car
  end

  delegate :car, to: :context

  def perform
    puts car
  end
end

class ChildService < ParentService
  def perform
    puts car
  end
end

ParentService.perform(car: 'Ferrari')
ChildService.perform(car: 'Lada')

expected output:

Ferrari
Lada

actual output:

Ferrari
NameError: undefined local variable or method 'car' for an instance of Servitium::Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions