Sha256: 575d3ba63c3cfd6b7f0f90abcc2f15765f24485fe8ec3d2c880d2c9b6f5d42ef

Contents?: true

Size: 801 Bytes

Versions: 7

Compression:

Stored size: 801 Bytes

Contents

module ActiveGit
  class SynchronizationError < StandardError

    def initialize(models)
      @models = models
    end

    def message
      messages = []
      @models.each do |model|
        model.errors.full_messages.each do |msg|
          attributes = {}
          model.attributes.each do |name, value|
            attributes[model.class.human_attribute_name(name)] = value
          end

          attributes = model.attributes.inject({}) do |memo, item|
            memo[model.class.human_attribute_name(item[0])] = item[1]
            memo
          end

          messages << "#{model.class.model_name.human} - #{msg}\n#{attributes}"
        end
      end
      messages.join("\n")
    end

    def to_s
      "#{self.class.name} (#{message}):\n#{backtrace.join("\n")}"
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
active_git-0.0.10 lib/active_git/synchronization_error.rb
active_git-0.0.9 lib/active_git/synchronization_error.rb
active_git-0.0.8 lib/active_git/synchronization_error.rb
active_git-0.0.7 lib/active_git/synchronization_error.rb
active_git-0.0.6 lib/active_git/synchronization_error.rb
active_git-0.0.5 lib/active_git/synchronization_error.rb
active_git-0.0.4 lib/active_git/synchronization_error.rb