Test and fix contact_versions controller affected by the same bug

This commit is contained in:
Maciej Szlosarczyk 2018-04-24 13:19:34 +03:00
parent a93228c579
commit cec05c3943
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
4 changed files with 66 additions and 4 deletions

View file

@ -1,5 +1,7 @@
module Admin
class DomainVersionsController < BaseController
include ObjectVersionsHelper
load_and_authorize_resource
def index

View file

@ -58,7 +58,7 @@
- @versions.each do |version|
- if version
- contact = Contact.new(version.object.to_h)
- version.object_changes.to_h.each { |k,v| contact.public_send("#{k}=", v.last) }
- attach_existing_fields(version, contact)
%tr
%td= link_to(contact.name, admin_contact_version_path(version.id))

View file

@ -1,5 +1,5 @@
- contact = Contact.new(@version.object.to_h)
- @version.object_changes.to_h.each { |k,v| contact.public_send("#{k}=", v.last ) }
- attach_existing_fields(@version, contact)
= render 'shared/title', name: contact.name
.row
@ -41,11 +41,11 @@
%br
%dt= t(:created)
%dt= t(:created_at)
%dd{class: changing_css_class(@version,"created_at")}
= l(contact.created_at, format: :short)
%dt= t(:updated)
%dt= t(:updated_at)
%dd{class: changing_css_class(@version,"updated_at")}
= l(contact.updated_at, format: :short)