BUGFUX: member slug needed on photos, to make link

This commit is contained in:
Brenda Wallace
2020-03-02 15:01:34 +13:00
parent 35f8289b06
commit 9fa3f36436
3 changed files with 3 additions and 2 deletions

View File

@@ -26,6 +26,7 @@ module SearchPhotos
# owner
owner_id: owner_id,
owner_login_name: owner.login_name,
owner_slug: owner.slug,
# counts
likes_count: likes_count,

View File

@@ -32,7 +32,7 @@ class Photo < ApplicationRecord
joins(:photo_associations).where(photo_associations: { photographable_type: model_name.to_s })
}
delegate :login_name, to: :owner, prefix: true
delegate :login_name, :slug, to: :owner, prefix: true
# This is split into a side-effect free method and a side-effecting method
# for easier stubbing and testing.

View File

@@ -5,7 +5,7 @@
%h5.ellipsis
= photo_icon
= link_to photo.title, photo_path(id: photo.id)
%i by #{link_to photo.owner_login_name, member_path(slug: photo.owner_login_name)}
%i by #{link_to photo.owner_login_name, member_path(slug: photo.owner_slug)}
- if photo.date_taken.present?
%small.text-muted
%time{datetime: photo.date_taken}= I18n.l(photo.date_taken.to_date)