From 14fe56d59ab210c089c3f43fe5bd3fe86cfaad00 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Wed, 27 Nov 2013 15:55:13 +0100 Subject: [PATCH] object nil? in calendar view --- app/views/calendars/show.html.erb | 2 +- app/views/calentries/show.html.erb | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb index 07c434d..9e35abb 100644 --- a/app/views/calendars/show.html.erb +++ b/app/views/calendars/show.html.erb @@ -24,7 +24,7 @@
<%= calendar @calendar.calentries do |entry| %> -
<%= link_to entry.name.to_s, polymorphic_path(entry.object) %>
+
<%= link_to entry.name.to_s, polymorphic_path(entry.try(:object)) unless entry.object.nil? %>
<% end %>
diff --git a/app/views/calentries/show.html.erb b/app/views/calentries/show.html.erb index faa5c9c..08f9cc6 100644 --- a/app/views/calentries/show.html.erb +++ b/app/views/calentries/show.html.erb @@ -1,13 +1,24 @@

<%= notice %>

-
+
<%= @calentry.summary %>
+
<%= unless @calentry.object.nil? +link_to @calentry.name.to_s, polymorphic_path(@calentry.object) +else +@calentry.name.to_s +end +%>
+ + +
<%= link_to @calentry.name.to_s, polymorphic_path(@calentry.object) + +%>
<%= I18n.l @calentry.start %> @@ -21,5 +32,5 @@
<%= link_to 'Edit', edit_calentry_path(@calentry) %> | -<%= link_to 'Back', calentries_path %> +<%= link_to 'Back', calendar_path(@calentry.calendar) %>