Class: Changelog::Notifier::Adapters::ActiveRecord

Inherits:
Base
  • Object
show all
Defined in:
lib/changelog/notifier/adapters/active_record.rb

Overview

Creates an ActiveRecord with the changelog

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Changelog::Notifier::Adapters::Base

Instance Method Details

#configured?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/changelog/notifier/adapters/active_record.rb', line 10

def configured?
  @model.to_s.empty? == false
end

#publish!(release_note_hash, version) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/changelog/notifier/adapters/active_record.rb', line 14

def publish!(release_note_hash, version)
  formatted_release_note = format_release_note_hash(release_note_hash)

  create_attributes = {}
  create_attributes[version_field] = version
  create_attributes[release_node_field] = formatted_release_note

  Array(@other_fields).each do |field, value|
    create_attributes[field] = value
  end

  @model.create!(create_attributes)
end