```ruby
class Ack < ActiveRecord::Base

  belongs_to :score

  validates_presence_of :value, :identity

  scope :recent, lambda {|count| order("updated_at desc").limit(count)}

  scope :by_uid_and_kind, lambda { |uid, kind|
    joins(:score).where(:scores => {:external_uid => uid, :kind => kind})
  }

  after_save :create_or_update_score
  after_destroy { |ack| ack.score.refresh_from_acks! }

  serialize :created_by_profile

  def create_or_update_score
    score.refresh_from_acks!
  end

  def uid
    "ack:#{score.path}$#{id}"
  end

  def attributes_for_export
    attributes.merge(:acked_uid => score.external_uid, :kind => score.kind, :paths => [uid])
  end
end
```

Implement river export as petroglyph template
user
```ruby
class Ack < ActiveRecord::Base

  belongs_to :score

  validates_presence_of :value, :identity

  scope :recent, lambda {|count| order("updated_at desc").limit(count)}

  scope :by_uid_and_kind, lambda { |uid, kind|
    joins(:score).where(:scores => {:external_uid => uid, :kind => kind})
  }

  after_save :create_or_update_score
  after_destroy { |ack| ack.score.refresh_from_acks! }

  serialize :created_by_profile

  def create_or_update_score
    score.refresh_from_acks!
  end

  def uid
    "ack:#{score.path}$#{id}"
  end

  def attributes_for_export
    template = "api/v1/views/ack.pg"
    Petroglyph::Engine.new(File.read(template)).to_hash({:ack => self}, template)
  end
end
```
assistant