ruby-on-railsrubyruby-on-rails-3service-object

Can I call a referring class in a service object?


I have a service object called from many different classes. Is there a way to call the referring class without passing it like this?

class Document
  ServiceObject.new('Document', id)
end

Can I refer to self or super or something in ServiceObject?


Solution

  • I don't think you can do it natively, but there is a gem for it according to sender class in ruby?