diff --git a/app/views/conversations/show.html.haml b/app/views/conversations/show.html.haml
index 24da42b95..acfc4c6d7 100644
--- a/app/views/conversations/show.html.haml
+++ b/app/views/conversations/show.html.haml
@@ -24,10 +24,10 @@
on #{message.created_at}
.col-md-4.text-end.float-end
= render 'members/tiny', member: message.sender
- - if message.notified_object.is_a?(Seed)
+ - if message.notified_object.present?
.col-12
About
- = link_to "#{message.notified_object.crop_name} seeds", seed_path(message.notified_object)
+ = link_to message.notified_object.to_s, polymorphic_path(message.notified_object)
.col-12
%p.text-justify
:markdown
diff --git a/spec/requests/messages_spec.rb b/spec/requests/messages_spec.rb
index 5e2274814..fad99f586 100644
--- a/spec/requests/messages_spec.rb
+++ b/spec/requests/messages_spec.rb
@@ -62,10 +62,10 @@ describe 'Messages' do
end
end
- describe 'the conversation about a seed' do
+ describe 'the conversation about a topic' do
let(:conversation) do
receipt = member.send_message(recipient, 'Could I have some?', subject_line)
- receipt.notification.update(notified_object: seed)
+ receipt.notification.update(notified_object: topic)
receipt.conversation
end
@@ -74,7 +74,20 @@ describe 'Messages' do
get conversation_path(conversation)
end
- it { expect(response.body).to include("About") }
- it { expect(response.body).to include(seed_path(seed)) }
+ context 'when topic is a seed' do
+ let(:topic) { seed }
+
+ it { expect(response.body).to include("About") }
+ it { expect(response.body).to include(seed_path(seed)) }
+ it { expect(response.body).to include(seed.to_s) }
+ end
+
+ context 'when topic is another notified object' do
+ let(:topic) { create(:planting) }
+
+ it { expect(response.body).to include("About") }
+ it { expect(response.body).to include(planting_path(topic)) }
+ it { expect(response.body).to include(topic.to_s) }
+ end
end
end