Sha256: accadccaf936f5cb40073eb07fed30022159a28a77d98624bd96a513abc1adef

Contents?: true

Size: 422 Bytes

Versions: 5

Compression:

Stored size: 422 Bytes

Contents

module Trailblazer::Operation::Responder
  # TODO: test me.
  def self.included(base)
    base.extend ClassMethods
  end

  module ClassMethods
    def model_name
      model_class.model_name
    end
  end

  extend Forwardable
  def_delegators :@model, :to_param, :destroyed?, :persisted?

  def errors
    return [] if @valid
    [1]
  end

  def to_json(*)
    self.class.representer_class.new(model).to_json
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
trailblazer-0.2.2 lib/trailblazer/operation/responder.rb
trailblazer-0.2.1 lib/trailblazer/operation/responder.rb
trailblazer-0.2.0 lib/trailblazer/operation/responder.rb
trailblazer-0.1.2 lib/trailblazer/operation/responder.rb
trailblazer-0.1.0 lib/trailblazer/operation/responder.rb