Sha256: 039f4f2ee0c0abffddae1169e86dfd7816490a0af98cf527d88f0c569fbd3017

Contents?: true

Size: 479 Bytes

Versions: 4

Compression:

Stored size: 479 Bytes

Contents

# frozen_string_literal: true

class Core::Repositories::<%= @scope_class %>::<%= @repository_class %> < Core::Repositories::AbstractRepository
  def initialize(id:)
    @id  = id
  end

  def call(builder: true)
    resource = <%= @model_class %>.find_by(id: @id)
    return Failure '<%= @subject_class %> not found' unless resource.present?
    unless resource.destroy
      return Failure build_errors(resource)
    end
    Success '<%= @subject_class%> Destroyed.'
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rider-kick-0.0.5 lib/generators/rider_kick/templates/domains/core/repositories/destroy.rb.tt
rider-kick-0.0.4 lib/generators/rider_kick/templates/domains/core/repositories/destroy.rb.tt
rider-kick-0.0.3 lib/generators/rider_kick/templates/domains/core/repositories/destroy.rb.tt
rider-kick-0.0.2 lib/generators/rider_kick/templates/domains/core/repositories/destroy.rb.tt