codeforamerica/ohana-api

View on GitHub
lib/phone_presenter.rb

Summary

Maintainability
A
15 mins
Test Coverage
A
100%
PhonePresenter = Struct.new(:row) do
  include ParentAssigner

  def to_phone
    phone = Phone.find_or_initialize_by(id: row[:id].to_i)
    phone.attributes = row
    assign_parents_for(phone, row)
    phone
  end
end